Python String isidentifier()

The syntax of isidentifier() is:

string.isidentifier()

isidentifier() Paramters

The isidentifier() method doesn't take any parameters.


Return Value from isidentifier()

The isidentifier() method returns:

  • True if the string is a valid identifier
  • False if the string is not a invalid identifier

Example 1: How isidentifier() works?

Output

True
False
False
False

Visit this page to learn what is valid identifier in Python?


Example 2: More Example of isidentifier()

Output

root33 is a valid identifier.
33root is not a valid identifier.
root 33 is not a valid identifier.