Python对列表list去重

1.使用循环(保留原顺序)old_list = [2, 3, 4, 5, 1, 2, 3]new_list = []for i in old_list: if i not in new_list: new_list.append(i)print(new_list) # [2, 3