str.upper() Uppercase
Last updated: 2026-09-22
str.upper() Uppercase
str.upper() returns an uppercased copy.
| Category | String Methods |
|---|---|
| Kind | Built-in Type Method |
| Python Version | all |
📝 Syntax
str.upper()
Returns:str. A copy with all letters uppercased.
Mutates the original:No (returns a new object)
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
HELLO WORLD
💡 Related Cases
More case studies coming soon — check back later.
❓ FAQ
QDoes upper() modify the original string?
ANo, it returns a new uppercase string and leaves the original unchanged.
QWhat happens when called on Chinese?
AIt is returned unchanged, because Chinese has no case.
QCan I use upper() for case-insensitive comparison?
AYou can, but casefold() is more recommended because it correctly handles characters that upper()/lower() cannot, such as the German ß.