m0_63573136 2022-08-30 10:44 采纳率: 50%
浏览 47
已结题

Python 字符串大小写转换

def change_string(str_test):
for single_word in str_test:
if 'a' <= single_word <= 'z':
str_test = str_test.replace(single_word, chr(ord(single_word) + 32))
return str_test

print(change_string('This is string example….wow!'))
print(change_string('Welcome To My World'))

#结果:
#Tˆ‰“ ‰“ “”’‰Ž‡ …˜Œ…….——!
#W…Œƒ… T M™ W’Œ„

  • 写回答

3条回答 默认 最新

  • 快乐小土狗 2022-08-30 10:55
    关注

    是减32

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 9月7日
  • 已采纳回答 8月30日
  • 创建了问题 8月30日