[Tutor] List Dup-Elim Method?
Doug Stanfield
DOUGS@oceanic.com
Fri, 2 Feb 2001 15:58:31 -1000
I think the Python idiom I've seen for this uses a dictionary as a temporary
holder. The dictionary needs unique keys so the following will leave a list
without duplicates:
theDict = {}
theList = [1, 2, 4, 6, 21, 3, 8, 5, 3, 8]
for element in theList:
theDict[element] = None
theList = theDict.keys()
-Doug-
> -----Original Message-----
> From: Curtis Larsen [mailto:curtis.larsen@Covance.Com]
> Sent: Friday, February 02, 2001 8:50 AM
> To: tutor@python.org
> Subject: [Tutor] List Dup-Elim Method?
>
>
> Is there an easy way to eliminate duplicate elements in a list?
> (A list method I missed, maybe?)
>
>
> Thanks!
> Curtis
>
>
>
> -----------------------------------------------------
> Confidentiality Notice: This e-mail transmission
> may contain confidential or legally privileged
> information that is intended only for the individual
> or entity named in the e-mail address. If you are not
> the intended recipient, you are hereby notified that
> any disclosure, copying, distribution, or reliance
> upon the contents of this e-mail is strictly prohibited.
>
> If you have received this e-mail transmission in error,
> please reply to the sender, so that we can arrange
> for proper delivery, and then please delete the message
> from your inbox. Thank you.
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>