Bytearray Methods

bytearray.title()

Uppercase the first ASCII letter in each consecutive run of ASCII letters and lowercase subsequent letters in that run. Digits, punctuation and non-ASCII bytes break runs. This simple rule does not understand human names or words in other languages. Returns a new mutable buffer even when no changes are needed; the original is untouched. These operations are intended for ASCII-compatible data, not arbitrary binary formats.

Formal Syntax & Structure

python syntaxpython
data.title()

Return Value

bytearray

bytearray containing the transformed byte values; receiver unchanged.

Working Example

Example Snippetpython
data = bytearray(b'api READY')result = data.title()print(result)print(bytearray(b"o'NEIL").title())print(data)print(result is data)
Python Reference