Test for structure

Simon Brunning simon.brunning at gmail.com
Wed Feb 16 10:13:47 EST 2005


On Wed, 16 Feb 2005 07:11:08 -0800 (PST), alex
<alexander.dietz at mpi-hd.mpg.de> wrote:
> 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?

<http://www.brunningonline.net/simon/blog/archives/001349.html>

-- 
Cheers,
Simon B,
simon at brunningonline.net,
http://www.brunningonline.net/simon/blog/



More information about the Python-list mailing list