Python String isidentifier() Method

Last Updated : 30 Dec 2025

Python isidentifier() method is used to check whether a string is a valid identifier or not. It returns True if the string is a valid identifier otherwise returns False.

Python language has own identifier definition which is used by this method.

Syntax of Python String isidentifier() Method

It has the following syntax:

Parameters

No parameter is required.

Return

It returns either True or False.

Different Examples for Python String isidentifier() Method

Let's see some examples of isidentifier() method to understand it's functionalities.

Example 1

A simple Example to apply isidentifier() method, it returns True. See the example.

Output:

True

Example 2

Here, we have created variety of identifiers. Some returns True and some False. See the example below.

Output:

True
False
False

Example 3

This method is useful in decision making therfore can be used with if statement.

 
Next TopicPython Strings