Checking the type

Moshe Zadka moshez at zadka.site.co.il
Wed Mar 21 07:24:53 EST 2001


On Wed, 21 Mar 2001 15:05:10 +0300 (MSK), Oleg Broytmann <phd at phd.pp.ru> wrote:

>    Yes, builtin fuction type(x):
> 
> if type(x) <> type([]):
>    print "not list!"

Or even better, isinstance

if not isinstance(x, types.ListType):
	print "not list!"

-- 
"I'll be ex-DPL soon anyway so I'm        |LUKE: Is Perl better than Python?
looking for someplace else to grab power."|YODA: No...no... no. Quicker,
   -- Wichert Akkerman (on debian-private)|      easier, more seductive.
For public key, finger moshez at debian.org  |http://www.{python,debian,gnu}.org




More information about the Python-list mailing list