xxxxxxxxxx
# To check the type of a variable
print( type(price) )
# To check if a veriable is an instance of something (float in this case)
print( isinstance(price, float) )
xxxxxxxxxx
# To check if the type of o is exactly str, excluding subclasses of str:
if type(o) is str:
# Use isinstance to check if o is an instance of str or any subclass of str:
if isinstance(o, str):
xxxxxxxxxx
obj = # Replace ... with the object you want to check the type of
obj_type = type(obj)
print(obj_type)