You can check if a variable is of a certain type in Python using the "isinstance()" function.
Here is an example to check if x is a string:
>>> x='hello'>>> isinstance(x, str)True
>>> x='hello'
>>> isinstance(x, str)
True