isidentifier() - Returns True if the string is an identifier

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.

Example

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

Output

True
True
False