determine variable type

Paul Rubin http
Thu Aug 18 21:07:24 CEST 2005

MCollins at writes:
> 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?

type(var) returns the type.  For example:

   if type(x) == type(3):
      print 'x is an integer'

More information about the Python-list mailing list