Answers for "how to check if variable in python is of what kind"

0

check if variable is function python

# Use types.FunctionType
>>> import types
>>> types.FunctionType
<class 'function'>

>>> def f(): pass

>>> isinstance(f, types.FunctionType)
True
>>> isinstance(lambda x : None, types.FunctionType)
True
Posted by: Guest on August-25-2021
0

how to check if variable in python is of what kind

kind = "World"
print(type(kind))
kind2 = 0876
print(type(kind2))
Posted by: Guest on September-24-2021

Code answers related to "how to check if variable in python is of what kind"

Python Answers by Framework

Browse Popular Code Answers by Language