RosettaCodeData/Task/String-case/Python/string-case.py

21 lines
563 B
Python
Raw Permalink Normal View History

2026-04-30 12:34:36 -04:00
import string
EXAMPLE_STRINGS = [
"alphaBETA",
"ação",
"o'hare O'HARE ohare don't",
"Stroßbùrri",
"ĥåçýджк",
"DŽLjnj",
]
for s in EXAMPLE_STRINGS:
print(f"original : {s}")
print(f"upper : {s.upper()}")
print(f"lower : {s.lower()}")
print(f"capitalize : {s.capitalize()}")
print(f"title : {s.title()}")
print(f"swapcase : {s.swapcase()}")
print(f"casefold : {s.casefold()}")
print(f"string.capwords : {string.capwords(s, sep=None)}\n")