how to find the type of a list element?

Joshua Muskovitz josh at open.com
Sun Nov 19 01:58:12 EST 2000


use type() on any object to find out what it is.

For example:

item = myList[someIndex]
if type(item) == type([]):
    # it's a list

Careful, though...  tuples are not lists, and lists are not tuples.

-- josh




-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----



More information about the Python-list mailing list