The Python Type
You may not know this, but Python may just be your type. Yes, Python can tell
you what type of variable you have or what type is returned from a function.
It’s a very handy little tool. Let’s look at a few examples to make it all clear:
x = "test"
y = 7
z = None
print(type(x))
# <class 'str'>
print(type(y))
# <class 'int'>
print(type(z))
# <class 'NoneType'>
As you can see, Python has a keyword called type that can tell you what is
what. In my real-life experiences, I’ve used type to help me figure out what is
going on when my database data is corrupt or not what I expect. I just add a
couple lines and print out each row’s data along with its type. This has helped
me a lot when I’ve been dumbfounded by some stupid code I wrote.