is variable a list?
Wm. King
wjk at wjk.mv.com
Wed Jan 5 00:35:47 EST 2000
Hi:
As a newbie (still am) - I asked similar question:
There is a function called type()
so if you had a variable: x = "This is a string"
then use type type(x)
you would get back: <type 'string'>
or if type(x) == types.StringType: print "This is a String"
see also module types
Hopefully this is a start .. and hopefully have not led you
down the wrong path.
cheers
James Punteney wrote:
> Hello,
>
> Is there some way to determine whether a variable is list or a string?
> Basically I have a variable that I would like to be able to be a string
> or a list, but I need some way to tell which it is.
>
> Thanks for the help,
> --James Punteney
>
> jamesp at simplypets.com
More information about the Python-list
mailing list