Does Python have the function like JavaScript?
typeof variable
Does Python have the function like JavaScript?
typeof variable
Try type()
>>> number = 1
>>> type(number)
<class 'int'>
>>> text = "Hello"
>>> type(text)
<class 'str'>
>>> arr = [1,2,3]
>>> type(arr)
<class 'list'>
You simply type
type(var)
or if you want to display it too, then use this:
print(type(var))