Bytes Methods
bytes.upper()
Map lowercase ASCII letters a–z to A–Z. Digits, punctuation, controls and byte values above 127 do not change. Unlike Unicode uppercasing this transformation never expands a character into multiple bytes. The original bytes remain unchanged; do not depend on the result having a different identity. These operations are intended for ASCII-compatible data, not arbitrary binary formats.
Formal Syntax & Structure
python syntaxpython
data.upper()Return Value
bytes
bytes containing the transformed byte values; receiver unchanged.
Working Example
Example Snippetpython
data = bytes(b'api-ready 7')result = data.upper()print(result)print(bytes(b'\xc3\x9f').upper())print(data)