Python OOPs


Python SQLite


Examples


Others


isidentifier() method in Python


The isidentifier() method returns True if the string is a valid identifier, and False when it only contains. If a string is only made up of alphanumeric letters (a-z), (0-9), or underscores (_), it is considered a valid identifier.

Syntax
string.isidentifier()

No Parameters

The following example shows, the string is identifier or not.

Example
a = "Hello"
b = "Hello001"
c = "01Hello"
d = "Hi Hello"
print(a.isidentifier())
print(b.isidentifier())
print(c.isidentifier())
print(d.isidentifier())

Output

True
True
False
False

Python String Methods