inspection
str.isalpha
Returns True if the string is non-empty and every character is an alphabetic Unicode letter. Digits, whitespace, and punctuation all return False.
str.isalpha() Parameters
| Parameter | Purpose |
|---|---|
| self | operates on the calling string; takes no arguments |
| returns | bool — False for empty strings |
Examples
>>> 'Hello'.isalpha()
True all letters
>>> 'Hello123'.isalpha()
False digits disqualify
>>> 'Straße'.isalpha()
True accented and non-ASCII letters count
>>> ''.isalpha()
False empty string is False
Gotcha
Spaces make it False — 'Hello World'.isalpha() is False. Empty string is always False.
Related methods
str.isdigit
Returns True if every character in the string is a digit and the string is non-empty. Includes Unicode digit characters like superscripts (²) but excludes signs, decimal points, and fractions like ½.
str.isspace
Returns True if the string is non-empty and every character is whitespace. Whitespace includes spaces, tabs, newlines, and other Unicode whitespace characters.
str.casefold
Returns a casefolded copy suitable for caseless matching. Stronger than lower(): it applies full Unicode case folding, e.g. German 'ß' becomes 'ss'.