Testing the data type of a value
luuk at invalid.lan
Sun May 12 04:16:40 EDT 2019
On 12-5-2019 09:27, binoythomas1108 at gmail.com wrote:
> When I run the following code, I get the following output:
> 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'>":
> Why isn't this working? Advance thanks for your time.
> and regards from
Return true if the object argument is an instance of the classinfo
argument, or of a (direct, indirect or virtual) subclass thereof. If
object is not an object of the given type, the function always returns
false. If classinfo is a tuple of type objects (or recursively, other
such tuples), return true if object is an instance of any of the types.
If classinfo is not a type or tuple of types and such tuples, a
TypeError exception is raised.
More information about the Python-list