all Python 3Strings (str)function
str.upper
case
Return a copy with all cased characters converted to uppercase.
Syntax
s.upper()
The result is not guaranteed to have the same length as the input: ß expands to two characters, SS, so indices computed on the uppercased text no longer line up with the original. upper() and lower() are not inverses either — s.upper().lower() can differ from s — so use casefold() when you need a caseless comparison.
Examples
print('Hello'.upper()) # → HELLO
print('привет'.upper()) # → ПРИВЕТ
print('straße'.upper()) # → STRASSE
See also
Open in the full glossarydocs.python.orgReport an inaccuracy