Easy Tutorial
❮ Ref Set Remove Python Function ❯

Python3 isalnum() Method

Python3 Strings


Description

The isalnum() method checks if the string consists of only letters and numbers.

Syntax

The syntax for the isalnum() method is:

str.isalnum()

Parameters

Return Value

Returns True if the string has at least one character and all characters are either letters or numbers; otherwise, it returns False.

Example

The following example demonstrates the isalnum() method:

Example (Python 2.0+)

#!/usr/bin/python3

str = "tutorialpro2016"  # String without spaces
print (str.isalnum())

str = "www.tutorialpro.org"
print (str.isalnum())

The output of the above example is:

True
False

Python3 Strings

❮ Ref Set Remove Python Function ❯