The isalnum() method in Python String checks whether the string comprises of the alphanumeric characters.
Here is the syntax for isalnum() method:
str.isalnum()
This method returns true in case all characters are alphanumeric in the string and there lies at least one character, otherwise, it returns false.
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 the above program, it produces the following result:
True False
Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.