Remove duplicates function in Python

Member

carey

by carey , in category: Python , a month ago

Remove duplicates function in Python

1
2
3
4
def remove_duplicates(seq):
    seen = set()
    seen_add = seen.add
    return [x for x in seq if x not in seen and not seen_add(x)]


Facebook Twitter LinkedIn Telegram Whatsapp Pocket

no answers