Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Python

str.isalpha

Tests whether a nonempty string consists entirely of Unicode letters.

Version: Python 3.14; repository image, production runtime not attested

Syntax

s.isalpha()

Tests whether a nonempty string consists entirely of Unicode letters.

Punctuation interrupts an otherwise alphabetic word, including a hyphen between letters.

Accented letters such as É and é belong to Unicode letter categories. The hyphen in a-b is punctuation, so one nonletter changes the result to false. Empty input is also false.

assert "é".isalpha() and not "e\u0301".isalpha()

Examples

print("Été".isalpha())
print("a-b".isalpha())

Result

True
False

Accented letters such as É and é belong to Unicode letter categories. The hyphen in a-b is punctuation, so one nonletter changes the result to false. Empty input is also false.

Sources