Test for structure

alex alexander.dietz at mpi-hd.mpg.de
Wed Feb 16 10:08:17 EST 2005


Hi there,

how can I check if a variable is a structure (i.e. a list)? For my
special problem the variable is either a character string OR a list of
character strings line ['word1', 'word2',...]

So how can I test if a variable 'a' is either a single character string
or a list? I tried:

if a is list:


but that does not work. I also looked in the tutorial and used google
to find an answer, but I did not.

Has anyone an idea about that?

Alex




More information about the Python-list mailing list