python中有可变对象和不可变对象,可变对象:list,dict.不可变对象有:int,string,float,tuple.
python不可变对象
int,string,float,tuple
先来看一个例子
def int_test():
i = 77
j = 77
print(id(77)) #140396579590760
print('i id:' + str(id(i))) #i id:140396579590760
print('j id:' + str(id(j))) #j id:140396579590760
print i is j