92 of 151 menu

The isalpha method

The isalpha method checks that a string consists only of letters. Nothing is passed to the method parameters. The method returns the Boolean values ​​True or False.

Syntax

string.isalpha()

Example

Let's check that the string consists only of letters:

txt = 'abcade' print(txt.isalpha())

Result of code execution:

True

Example

Now let's say there are other symbols in the line:

txt = 'abcade12' print(txt.isalpha())

Result of code execution:

False

See also

  • method isalnum,
    which checks if a string contains letters and numbers
  • method isdigit,
    which checks if a string contains only numbers
  • method isnumeric,
    which checks if a string contains only numbers
  • method isspace,
    which checks if a string contains only spaces
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