Python 没有用于声明变量的命令,直接使用赋值方式创建变量:
例:
Python中的变量:
x = 5y = "Hello, World!"
变量不需要使用任何特定类型进行声明,甚至可以在设置后更改类型。
x = 4 # x 是 int 类型x = "Sally" # x 是 str 类型print(x)