li = [100,45,'lisi','wangwu',100,'lisi'] 去除列表中重复的多余元素;
li = [100,45,'lisi','wangwu',100,'lisi'] new_li = [] for i in li: if i not in new_li: new_li.append(i) print(new_li)
/usr/local/bin/python3.6 "/Users/muxiuyulin/Desktop/study python/test4.py"
[100, 45, 'lisi', 'wangwu']
Process finished with exit code 0