小册名称:Python合辑4-130个字符串操作示例
将大写字符串转换为句子大小写
text = ['CANADA', 'JAPAN']text = [txt.capitalize() for txt in text]print(text)
text = ['CANADA', 'JAPAN']
text = [txt.capitalize() for txt in text]
print(text)
Output:
['Canada', 'Japan']