【发布时间】:2011-12-13 07:18:20
【问题描述】:
我有一个脚本可以读取输入并列出它,但是我希望它将大写字母转换为小写字母,我该怎么做?
这就是我得到的
for words in text.readlines():
sentence = [w.strip(',.') for w in line.split() if w.strip(',.')]
list.append(sentence)
【问题讨论】:
-
如果你找到了
str的strip和split方法,那么搜索upper和lower有多难? -
请在来这里之前将这些内容输入谷歌,python 文档被点击 1 并且有正确的答案。记录在案,答案是
thestring.lower()
标签: python