【发布时间】:2018-08-06 10:25:53
【问题描述】:
我想将字符串中的所有大写单词 (以大写字符开头,其余字符为小写的单词) 转换为小写字符。例如,如果我的初始字符串是:
text = " ALL people ARE Great"
我希望我的结果字符串是:
"ALL people ARE great"
我尝试了以下方法,但没有成功
text = text.split()
for i in text:
if i in [word for word in a if not word.islower() and not word.isupper()]:
text[i]= text[i].lower()
我还检查了相关问题Check if string is upper, lower, or mixed case in Python.。我想遍历我的数据框以及满足此条件的每个单词。
【问题讨论】: