列表去重保留最后面的元素

1
2
3
4
5
6
7
new_list = []
for i in old_list:
if i not in new_list:
new_list.append(i)
else:
new_list.remove(i)
new_list.append(i)