osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

The use of type()


I need to print something like "this variable is int" or "this variable 
is string"

n1 = 10
n2 = 23

print ("Total of n1+n2 is: ",n1+n2," the type is", type(n1+n2))

When I run it I have:

Total of n1+n2 is:  33  the type is <class 'int'>
 >>>

I'd like to read "the type is int" and NOT "the type is <class 'int'>, 
how could I solve it?

^Bart