Python: Exemple d’utilisation de la méthode type

Author:


{filelink=16891}

def eval(value):
    print type(value), value
 
eval(1)
eval(1.0)
eval("Bienvenu")
 
"""
<type 'int'> 1
<type 'float'> 1.0
<type 'string'> one
"""