16 Jun
2004
16 Jun
'04
6:10 a.m.
On Tue, Jun 15, 2004 at 06:29:59PM -0500, Terry Hancock wrote:
if int(spam)==spam: print "Yep, it's an integer."
Technically this would accept "1.0000" as well as "1", but it's unclear to me why you would care about the actual storage format versus the meaning. It won't accept '1', though, which might matter if spam comes from a web form.
Sure it will. $ python Python 2.3.3 (#1, Feb 2 2004, 03:53:32) [GCC 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r3, propolice)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
int(1) == int(1.0) == int('1') True
-- Paul Winkler http://www.slinkp.com