Python中的变量有两个特点: 1. 无需声明 a = 1 2. 不与类型绑定 a = 1 a = 'hello world' 变量名只是内存中具体对象的一个引用(reference). 对于 a = 1,内存模型如下: 对于 a = 1 b = a 内存模型如下: 可以通过id(x)获取变量x所引用对象的内存地址 a = 1 b = a print('address of the object referenced by a:', id(a)) print('address of the o…