我知道如何在 python 中将选定的文本从小写转换为大写,反之亦然:使用
string.swapcase();
而且我知道如何将所选文本大写:与
string.capitalize();
但我想得到一个循环小写 -大写- 所选文本的大写。
可以用python吗?
大写:文本;
大写:文本;
小写:文本。
可能的解决方案
### Get the current selection.
sText=clipboard.get_selection()
### Analyse.
if sText.islower():
sText=sText.capitalize()
elif sText.isupper():
sText=sText.lower()
else:
sText=sText.upper()
### Send the result.
keyboard.send_keys(sText)
这个解决方案的问题是文本没有保持选中状态。
白板的微信
相关分类