checking if an element is a list or an atom

(iamamoocow) #1

Is the only way to test if an object is a list, and not an atom, with the type() function?


(theeth) #2

you can also use the types module like this:

from types import ListType
if type(object) == ListType:
        print "this is a list"

I hope that’s clear.