String Methods

str.upper()

Convert text using Unicode uppercase mappings. Length may increase because a character can map to more than one code point. Uncased scripts and punctuation are not turned into Latin characters. The result is not necessarily classified as uppercase if it contains no cased characters. The receiver is immutable; the operation returns a string without modifying it. Do not rely on a new object identity.

Formal Syntax & Structure

python syntaxpython
text.upper()

Return Value

str

String containing the transformed text.

Working Example

Example Snippetpython
label = "Maße"print(label.upper())print(len(label), len(label.upper()))print("سلام".upper())
Python Reference