python去除列表里的重复记录 python列表去重
程序员文章站
2022-07-13 07:54:16
...
#方法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] >>>