How to detect what type a variable is?
lardissone at gmail.com
Wed Nov 29 17:25:35 CET 2006
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":
On Nov 29, 12:41 pm, Grant Edwards <gra... at visi.com> wrote:
> On 2006-11-29, Leandro Ardissone <lardiss... at gmail.com> wrote:
> > I want to know what type is a variable. For example, I get the
> > contents of an xml but some content is a list or a string, and
> > I need to know what type it is.
> >>> x = 'asdf'
> >>> type(x)
> <type 'str'>
> >>> i = 0
> >>> type(i)
> <type 'int'>--
> Grant Edwards grante Yow! I Know A Joke!!
More information about the Python-list