i2tutorials

Isidentifier() method in Python String Module

Isidentifier() method in Python String Module

Isidentifier method in string module returns the output as TRUE if the string is able to identify a valid word or identifier, or else it return the output as FALSE.


Syntax:

str.isidentifier()


Example-1:

text = "Government"
x = text.isidentifier()
print(x)


Output:


Example-2:

text = "Demo nstr ate"
x = text.isidentifier()
print(x)


Output:

Exit mobile version