Skip to content
Advertisement

How can I check if character in a string is a letter? (Python)

I know about islower and isupper, but can you check whether or not that character is a letter? For Example:

JavaScript

Is there any way to just ask if it is a character besides doing .islower() or .isupper()?

Advertisement

Answer

You can use str.isalpha().

For example:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement