How to detect what type a variable is?
Leandro Ardissone
lardissone at gmail.com
Wed Nov 29 11:37:21 EST 2006
great,
that is just what I need!
Thank you all!
--
Leandro Ardissone
On Nov 29, 1:29 pm, Roberto Bonvallet <Roberto.Bonval... at cern.ch>
wrote:
> Leandro Ardissone 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
> > not..
>
> > Tried with:
> > if type(artistList) == "<type 'list'>":
>
> > and
> > if type(artistList) == "list":
>
> > but nothing..type() doesn't return a string, it returns a type object.
> You should try this:
>
> if isinstance(artistList, list):
> ...
>
> Cheers,
> --
> Roberto Bonvallet
More information about the Python-list
mailing list