Perhaps you're looking for the type() built in function and the types modules?
>>> type('aaa') <type 'str'> >>> type([]) <type 'list'> >>> import types >>> if type([]) is types.ListType: ... print 'is a list' ... is a list Chris On Wed, 16 Feb 2005 07:10:56 -0800 (PST), alex <[EMAIL PROTECTED]> wrote: > 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 > > -- > http://mail.python.org/mailman/listinfo/python-list > -- "It is our responsibilities, not ourselves, that we should take seriously." -- Peter Ustinov -- http://mail.python.org/mailman/listinfo/python-list