Python String isalnum() Method

Returns True if all the characters in the string are alphanumeric. This would be a-z, A-Z, and 0-9. Punctuation, spaces, symbols, and other characters are not considered a letter or a number.

Syntax

Python
string.isalnum()

Example

Python
str1 = 'Abc123'
str2 = "Hello World!!!!"
print(str1.isalnum())
print(str2.isalnum())

Output

True
False