Is there a numeric equivalent to ‘.isalpha’ in python 2?
Are you meaning you want to check a string and see if all of its characters are numbers?
.isdigit() should help:
>>> "55".isdigit() True >>> "793".isdigit() True >>> "ab".isidigit() False
For more information on it here is the documentation:
I searched it up and it said .is numeric() but it kept coming up with an error.
I will try this out!
According to the documentation,
.isnumeric() is built to work with string objects that are encoded in Unicode:
By default Python 2.7 encodes characters in ASCll, however Unicode, or UTF-8, offers many more characters, so the option exists to designate a string in this format by preceeding quotation marks with a “u”.
>>> str = u"45" >>> str.isnumeric() True
THnak you. I will look through it