标签:复制 列表 python ati tis pre ack 赋值 print
‘‘‘
切片复制时的id值与直接赋值的列表不一样
‘‘‘
list_pratisce = [5,6,8,9,19]
list_pratisce_backup = list_pratisce
list_pratisce_backup_qiepian = list_pratisce[:]
print(‘list_pratisce的值是:‘,id(list_pratisce),‘list_pratisce_backup的值是:‘,id(list_pratisce_backup),‘list_pratisce_backup_qiepian‘,id(list_pratisce_backup_qiepian))
打印结果:
list_pratisce的值是: 2028711862920 list_pratisce_backup的值是: 2028711862920 list_pratisce_backup_qiepian 2028711862984
标签:复制 列表 python ati tis pre ack 赋值 print
原文地址:https://blog.51cto.com/9237101/2440127