[SOLVED] How to differentiate between a number and a letter or sign?


If I have a digit within a string I can just do:

x = "2"

and I get True. But when I do this:

isinstance(x, str)

By my understanding this also results in True.

My question is now how can I tell if it is a character or a number?


Use isalpha() for this:

x = "2"

Returns False

Answered By – JANO

Answer Checked By – Cary Denson (BugsFixing Admin)

Leave a Reply

Your email address will not be published.