Python 3 reference · String Methods
Python String upper() Method
Return a copy of the string with all cased characters converted to upper case.
Python 3 Since 3.0
Syntax
str.upper()
Return value
A new string.
Examples
print("hello world".upper())
Output
HELLO WORLD
code = "ab-12x"
print(code.upper(), "straße".upper())
Output
AB-12X STRASSE
Version history
| Version | Change |
|---|---|
| Python 3.0 | Added |
Related
str.lower()· Return a copy of the string with all cased characters converted to lower case.str.isupper()· Return True if all cased characters are upper case and there is at least one cased character.str.capitalize()· Return a copy of the string with the first character in upper case and the rest in lower case.str.title()· Return a title-cased copy: the first letter of each word upper case and the rest lower case.- Python Strings · tutorial