check if object is number

Michael Hartl mhartl at post.harvard.edu
Fri Feb 11 15:54:32 EST 2005


As luck would have it, isnumber is a built-in Python function:

>>> isnumber(1)
True
>>> isnumber(1.0)
True
>>> isnumber('1')
False

Michael

--
Michael D. Hartl, Ph.D.
Chief Technology Officer
http://quarksports.com/




More information about the Python-list mailing list