str#

This page overviews features of the str datatype in python. Find out more in the correspoding section of the official documentation.

istitle - is first capital#

Lets you check if all words in the calling string are capitalised.

The following example shows how it works for

  • Lower case only;

  • One capitalised word;

  • Line with several capitalised words;

  • Line with several words but only the first one is capitalised.

test_lines =[
    "test line",
    "Test",
    "Test Line",
    "Test line"
]

for test_line in test_lines:
    print(f"\"{test_line}\".istitle() -> {test_line.istitle()}")
"test line".istitle() -> False
"Test".istitle() -> True
"Test Line".istitle() -> True
"Test line".istitle() -> False