Skip to content
Related Articles

Related Articles

Improve Article

Python string | isalnum()

  • Difficulty Level : Basic
  • Last Updated : 05 Jan, 2018

isalnum() function in Python programming language checks whether all the characters in a given string is alphanumeric or not.

Alphanumeric:A character that is either a letter or a number


string_name is the name of the string

Parameter: isalnum() method takes no parameters


True: If all the characters are alphanumeric
False: If one or more characters are not alphanumeric

Below is the Python implementation of the isalnum() method

# Python program to demonstrate the use of
# isalnum() method  
# here a,b and c are characters and 1,2 and 3
# are numbers
string = "abc123"
# here a,b and c are characters and 1,2 and 3 
# are numbers but space is not a alphanumeric 
# character
string = "abc 123" 



 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :