本文實例講述了python刪除列表中重復記錄的方法。分享給大家供大家參考。具體實現方法如下:
1
2
3
4
|
def removeListDuplicates(seq): seen = set () seen_add = seen.add return [ x for x in seq if x not in seen and not seen_add(x) ] |
希望本文所述對大家的Python程序設計有所幫助。