Python String isalnum() Method

You are Here:

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.

Example

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

Output

True True False True

Syntax

txt.isalnum()

Parameter Values

It does not take any parameter.

Return Value

ValueExplanation
TrueIf this string is an alphanumeric.
FalseIf this string is not an alphanumeric.

Reminder

Hi Developers, we almost covered 90% of String functions and Interview Question on Python with examples for quick and easy learning.

We are working to cover every Single Concept in Python.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author