Testing the data type of a value

binoythomas1108 at gmail.com binoythomas1108 at gmail.com
Sun May 12 03:27:10 EDT 2019


When I run the following code, I get the following output:
>>> print(type(5))
class 'int'

Next, I try to compare the data-type of 5 with the earlier output, I get no output:
>>> if type(5) == "<class 'int'>":
        print("Integer")

Why isn't this working? Advance thanks for your time.

and regards from
Binoy


More information about the Python-list mailing list