all Python 3Byte sequencesfunction
bytearray.istitle
bytearray — is* checks
Checks that the sequence is in title case: each word starts with an uppercase ASCII letter followed by lowercase ones.
Syntax
ba.istitle(...)
The test is purely mechanical: every run of letters must start with an upper-case byte and continue in lower case — it has nothing to do with real headline capitalization rules. Any non-letter byte (digit, hyphen, punctuation) acts as a word boundary, so b'Hello2World' passes while b'HI There' fails on the second consecutive capital.
Examples
print(bytearray(b'Hi There').istitle()) # → True
print(bytearray(b'hi there').istitle()) # → False
print(bytearray(b'HI There').istitle()) # → False
print(bytearray(b'Hello2World').istitle()) # → True
print(bytearray(b'').istitle()) # → False
print(bytearray(b'hi there').title()) # → bytearray(b'Hi There')
See also
Open in the full glossarydocs.python.orgReport an inaccuracy