Python String isalnum() method

The isalnum() method is used to check that all the characters of a non-empty string are alphanumeric and there is at least one character in the string. This method returns True if the given string only has alphanumeric characters and the length of the string is a minimum of one character.

Syntax:

String_var.isalnum()

This method accepts no parameter.

Return Value:
True If the given string only has alphanumeric characters.
False If the given string has any non-alphanumeric character.
			

# Python example of the isalnum() method

website = "tutorialsnation"
print(website. isalnum ())   #return True

website = "tutorials nation"
print(website. isalnum ())   #return False it contains white space

website = "@tutorialsnation"
print(website. isalnum ())   #return False it contains special character

				

Output:

True False False