[EMAIL PROTECTED] wrote:
> trying to determine a variable type, specifically that a variable is an
> integer.
>
> i tried using type(var) but that only seemed to produce a response in the
> command line.
>
> is there a built in python function to determine if a variable is an
> integer?
if isinstance(var, (int, long)):
print 'var (%r) is an integer' % var
elif isinstance(var, float) and int(var) == var:
print 'var (%r) is a float that could be an integer' % var
else:
print 'var (%r) is not an integer' % var
--Scott David Daniels
Scott [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list