89 of 151 menu

The istitle method

The istitle method checks the first character of each word in a string for uppercase. Nothing is passed to the method parameters. The method returns the Boolean values ​​True or False.

Syntax

string.istitle()

Example

Let's check if each word in a string starts with uppercase:

txt = 'Abc Def' print(txt.istitle())

Result of code execution:

True

Example

Now let's change the case of the first character in the second word and check our string again:

txt = 'Abc def' print(txt.istitle())

Result of code execution:

False

Example

Let's add numbers to the first word and check our string again using the istitle method:

txt = '12abc Def' print(txt.istitle())

Result of code execution:

False

See also

  • method isupper,
    which checks all characters in a string for uppercase
  • method islower,
    which checks the characters of a string for lowercase
  • method upper,
    which returns all characters of a string in uppercase
  • method capitalize,
    which changes the first character of a string to uppercase
  • method casefold,
    which returns all unicode characters in lowercase
  • method lower,
    which returns all lowercase ASCII characters
  • method swapcase,
    which changes the case of characters to the opposite
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline