IsList?

Magnus Lie Hetland mlh at vier.idi.ntnu.no
Mon Apr 8 02:50:51 EDT 2002


In article <slrnab2b3b.1gd.gerhard at lilith.my-fqdn.de>, Gerhard
=?iso-8859-15?Q?H=E4ring?= wrote:
>John wrote in comp.lang.python:
>> Hi, How can one know wheter var 'a' is list or not? Is there any
>> IsList-like function?
[snip lots of stuff]

If you want to check for sequences in general you can use the
isSequenceType function:

>>> from operator import isSequenceType
>>> isSequenceType([1, 2, 3])
1
>>> isSequenceType((1, 2, 3))
1
>>> isSequenceType("1, 2, 3")
1
>>> isSequenceType(123)
0

--
Magnus Lie Hetland                                  The Anygui Project
http://hetland.org                                  http://anygui.org



More information about the Python-list mailing list