数据结构与算法-列表去重-不改变原有顺序

19 阅读1分钟
list1 = [1,2,3,4,5,6,7]
newlist = []
for i in list1:
    if i not in newlist:
        newlist.append(i)
print('newlist: ', newlist)

image.png