help, function to get variable type
Eli Pollak
eli at elipollak.com
Wed Dec 24 02:36:30 EST 2003
if isinstance(var,str):
print 'string'
elif isisnstance(var,int):
print 'int'
elif isinstance(var,list):
print 'list'
elif isinstance(var,someobject) # where someobject is a class that has been
defined
print 'someobject'
----- Original Message -----
From: "iip" <iip at chead.org>
To: <python-list at python.org>
Sent: Wednesday, December 24, 2003 6:25 PM
Subject: help, function to get variable type
> Hi All,
>
> What is the function to check the varible type, for example, below is like
> in my clipper language:
>
> x = valtype(m)
>
> x will be "N", "C", "A", etc...
>
> thanks,
>
> -iip-
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list