Checking the type

Oleg Broytmann phd at phd.pp.ru
Wed Mar 21 07:05:10 EST 2001


On Wed, 21 Mar 2001, Markus Reitz wrote:
> is there a possibilty to check if a variable refers to an object of type x?

   Yes, builtin fuction type(x):

if type(x) <> type([]):
   print "not list!"

Oleg.
----
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.





More information about the Python-list mailing list