Python String isidentifier() Method

Returns True if the string is considered to be an identifier. An identifier can only contain the lowercase letters a-z, A-Z, digits 0-9, and underscores.

Syntax

Python
string.isidentifier()

Example

Python
print('abc9_42'.isidentifier())
print('ABC9_42'.isidentifier())
print('abc9_42,43'.isidentifier())

Output

True
True
False