python写的英文字符大小写转换代码示例

几行代码的小工具,用于进行如下转换

transactions on cloud computing

=》

transactions on cloud computing

代码如下:

orig = ‘transactions on cloud computing’
splited = orig.split(‘ ‘)
handled = ”
for word in splited:
word = word[0] + word[1:].lower()
handled += (‘ ‘ + word)
handled = handled[1:]
print handled
#handled is ‘transactions on cloud computing’

Posted in 未分类

发表评论