Duplicates in lists

Jason Stokes jstok at bluedog.apana.org.au
Thu Mar 9 22:34:51 CET 2000


Matthias Huening wrote in message <8a80a8$8cv8$1 at www.univie.ac.at>...
>
>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


Not very efficient, alas.





More information about the Python-list mailing list