On Mon, Feb 11, 2019 at 8:46 AM ^Bart <gabriele1nos...@hotmail.com> wrote:
>
> 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?
>

Many things in Python, including functions and types, have inherent names.

>>> print(sys.__name__, int.__name__, print.__name__)
sys int print

Enjoy!

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to