import random
import copy
def insertSort(num):
"""
插入排序
:param num:
:return:
"""
sortL = []
print(num)
for i in range(1, len(num)):
key = num[i]
j = i - 1
while j >= 0 and key < num[j]:
num[j + 1] = num[j]
j -= 1
num[j + 1] = key
sortL.append(copy.deepcopy(num))
# for i in sortL:
# print(i)
- Python append() 与深拷贝、浅拷贝