So überprüfen Sie den Typ einer Variablen in Python
print(type(x))
Fine Finch
print(type(x))
a=int(5)
b=float(5.6)
c=str("Hello world!")
x = "20"
y = 5.7
z = 90
print(type(x))
print(type(y))
print(type(z))
a = int(x)
b = str(y)
c = float(z)
print(type(a))
print(type(b))
print(type(c))
myVar = ""
myType = type(myVar)
# Output: <class 'str'>
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_12148/2794355031.py in <module>
----> 1 x4 = [x1, x2, x3]
NameError: name 'x1' is not defined