Python中字符串转换大小写的方法有三种:
s = "hello"
s_upper = s.upper()
print(s_upper) # 输出:HELLO
s = "HELLO"
s_lower = s.lower()
print(s_lower) # 输出:hello
s = "hello world"
s_title = s.title()
print(s_title) # 输出:Hello World
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: python中为什么没有cmp函数