How to detect what type a variable is?
danielkleinad at gmail.com
Wed Nov 29 17:37:23 CET 2006
On 29 Nov 2006 08:25:35 -0800, "Leandro Ardissone"
<lardissone at gmail.com> wrote:
>And how I can compare this "<type 'str'>" output ?
>I want to decide what to do if the var is an string and what to do if
>if type(artistList) == "<type 'list'>":
>if type(artistList) == "list":
Try it this way...
>>> artistList = 
>>> isinstance(artistList, list)
>>> if isinstance(artistList, list):
print "I'm a list."
I'm a list.
More information about the Python-list