how to check if variable in python is of what kind

Solutions on MaxInterview for how to check if variable in python is of what kind by the best coders in the world

showing results for - "how to check if variable in python is of what kind"
Maelyne
21 Nov 2016
1# Use types.FunctionType
2>>> import types
3>>> types.FunctionType
4<class 'function'>
5
6>>> def f(): pass
7
8>>> isinstance(f, types.FunctionType)
9True
10>>> isinstance(lambda x : None, types.FunctionType)
11True
12
May
04 Sep 2019
1kind = "World"
2print(type(kind))
3kind2 = 0876
4print(type(kind2))