Python String isalnum() Method

Last Updated:

Python String isalnum()

The isalnum() method checks whether all the characters of the string are alphanumeric or not.

In python, alphanumeric is a sequence of characters which consists of either alphabets (a-z or A-Z) or numbers (0 - 9).

Note: This method does not allow special characters: (space)!#%&? etc.


Python Compiler
str1 = "python" str2 = "123" str3 = "python 123" str4 = "python123" print(str1.isalnum()) # True print(str2.isalnum()) # True print(str3.isalnum()) # False print(str4.isalnum()) # True



Parameter Values

It does not take any parameter.

Return Value

True If this string is an alphanumeric.
False If this string is not an alphanumeric.

Share this Page

Meet the Author