How to check if a string "is" an int?
Paul Rubin
http
Fri Dec 23 05:52:00 EST 2005
"Fredrik Lundh" <fredrik at pythonware.com> writes:
> no, but all characters in the string belongs to the "digit" character
> class, which is what the "is" predicates look for.
That description is not quite right. All characters in the empty
string belong to the "digit" character class, but isdigit returns
false (which it probably should).
Python 2.3.4 (#1, Feb 2 2005, 12:11:53)
[GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> ''.isdigit()
False
More information about the Python-list
mailing list