Home >>Python String Methods >Python String isidentifier() Method

Python String isidentifier() Method

Python String isidentifier() Method

Python String isidentifier() Method is an inbuilt function of python and is used to check a string is a valid identifier or not, otherwise false.

Syntax:
string.isidentifier()
Here is an example of Python String isidentifier() Method:

ident = "phptpoint"
x = ident.isidentifier()
print(x)

Output:
True
Example 2:

a = "abcxyz"  
b = "50sbcxyz"  
c = "$php"  
d = a.isidentifier()  
e = b.isidentifier()  
f = c.isidentifier()   
print(d)  
print(e)  
print(f)  

Output:
True
False
False