Python中可以使用字符串的方法upper()
和lower()
来将字符串转换为大写和小写形式。
示例代码:
string = "Hello, World!"
upper_string = string.upper()
lower_string = string.lower()
print(upper_string) # 输出结果为 "HELLO, WORLD!"
print(lower_string) # 输出结果为 "hello, world!"
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: python怎么设置环境变量