.isalnum()
Anonymous contributor
Anonymous contributor1 total contribution
Anonymous contributor
Published Sep 27, 2023
Contribute to Docs
The .isalnum()
string method takes in a string and returns True
if all the characters are alphanumeric (A-Z
, a-z
, 0-9
). Otherwise, it returns False
if the string contains any non-alphanumeric characters (e.g. @ # $ % - *
).
Syntax
my_string.isalnum()
This method does not have any parameters.
Example
The examples below use .isalnum()
to check if all the characters are alphanumeric:
my_string = "AlphaNumeric001"print(my_string.isalnum())
The code above will result in the following output:
True
Codebyte Example
The code below is runnable and uses the .isalnum()
method:
All contributors
- Anonymous contributorAnonymous contributor1 total contribution
- Anonymous contributor
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.