Python 文字列 大文字/小文字変換の基本と実践
Pythonで、文字列を大文字や小文字に変換するためには、upper()やlower()というメソッドを使うことができます。
サンプルコード:
string = "Hello, World!"
upper_string = string.upper()
lower_string = string.lower()
print(upper_string) # 输出结果为 "HELLO, WORLD!"
print(lower_string) # 输出结果为 "hello, world!"