Python string method isalnum() checks whether the string consists of alphanumeric characters.
Following is the syntax for isalnum() method −
This method returns true if all characters in the string are alphanumeric and there is at least one character, false otherwise.
The following example shows the usage of isalnum() method.
#!/usr/bin/python str = "this2009"; # No space in this string print str.isalnum() str = "this is string example....wow!!!"; print str.isalnum()
When we run above program, it produces following result −