Python教程

python去重后保证顺序不变

本文主要是介绍python去重后保证顺序不变,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
l1 = [174149,174183,174177,174171,174131,174087,174135,174181,174127,174145,174137,174111,174097,174185,174189,174145,174179,174163,174167,174095,174095,174105,174155,174159,174151,174169,174187,174175,174101,174173,174165,174103,174161,174121,174077,174141,174125,174861,174825,174855,174861,174855,174837,174845,174827,174813,174857,174807,174865,174839,174857,174865,174807,174799,174843,174841,174805,174815,174853,174871,174869,174821,174851,174835,174859,174801,174823,174863,174847,174873,174873,174849,174811]

l2 = list(set_l1)
l2.sort(key=l1.index)

print(l2)

 

这篇关于python去重后保证顺序不变的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!