Issue
If I have a digit within a string I can just do:
x = "2"
x.isdigit()
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?
Solution
Use isalpha()
for this:
x = "2"
x.isalpha()
Returns False
Answered By - JANO Answer Checked By - Terry (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.