Python String Case Conversion Guide

In Python, you can use the methods upper() and lower() on strings to convert them to uppercase and lowercase, respectively.

Example code:

string = "Hello, World!"
upper_string = string.upper()
lower_string = string.lower()

print(upper_string)  # 输出结果为 "HELLO, WORLD!"
print(lower_string)  # 输出结果为 "hello, world!"
bannerAds