Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Python

str.upper

Returns the Unicode uppercase mapping of the text.

Version: Python 3.14; repository image, production runtime not attested

Syntax

s.upper()

Returns the Unicode uppercase mapping of the text.

Uppercasing can expand a single character into more than one code point.

Unicode uppercase conversion can map one code point to several others. In straße the sharp s becomes SS, giving STRASSE. Uppercasing the sharp s alone therefore yields a length of two code points.

assert "ß".upper() == "SS" and len("straße".upper()) == 7

Examples

print("straße".upper())
print(len("ß".upper()))

Result

STRASSE
2

Unicode uppercase conversion can map one code point to several others. In straße the sharp s becomes SS, giving STRASSE. Uppercasing the sharp s alone therefore yields a length of two code points.

Sources