python去除列表里的重复记录 python列表去重
程序员文章站
2022-07-12 23:50:39
...
#方法1: >>> mylist = [3,5,8,5,3,12] >>> print dict().fromkeys(mylist).keys() [8, 3, 12, 5] >>> #方法2: >>> mylist = [3,5,8,5,3,12] >>> print list(set(mylist)) [8, 3, 12, 5] >>>