What Is Alphanumeric?


Alphanumericals are a combination of alphabetical and numerical characters. Generally, the Latin letters and Arabic digits are used to create alphanumerically. Alphanumeric does not contain special characters like “*,~.:-?” etc.

Alpha or Alphabetical

Alpha or Alphabetical specifies the Latin letters. These letters can be lower case or uppercase. These Latin letters also expressed as A-Z+a-z.

Numeric

Numeric is the number part where Arabic numbers which are actually from 0-9 are used.

Python isalphanumeric() Function

Most of the programming languages provide functions in order to check if given character set or string or text is alphanumeric. Python is one of them where is provides the isalnum() function. In the following examples we will use this function to the if given text is alphanumeric.

text="abc123ABC123"

text.isalnum()
# The output will be True



text="abc123ABC123."

text.isalnum()
# The output will be False



text="abc123ABC123?"

text.isalnum()
# The output will be False



text="abc"

text.isalnum()
# The output will be True



text="123"

text.isalnum()
# The output will be True
Python isalphanumeric() Function

LEARN MORE  Python Glob() Function To Match Path, Directory, File Names with Examples

Leave a Comment