Duplicates in lists

Matthias Huening matthias.huening at univie.ac.at
Thu Mar 9 11:50:35 CET 2000


Michael Husmann wrote:
>
>is there someone who has an efficient function that finds
>all duplicates in a list?
>

What about something like this:

def dup(a):
    b = []
    for x in a:
        if not x in b:
            b.append(x)
    return b


Cheers, Matthias

- - - - -
matthias.huening at univie.ac.at
http://www.ned.univie.ac.at/






More information about the Python-list mailing list