[Pythonmac-SIG] Duplicate items in a list
Anthony M. Ingraldi
A.M.INGRALDI@larc.nasa.gov
Mon, 09 Aug 1999 08:35:04 -0400
On Monday, August 9, 1999, Pieter Claerhout wrote:
> does anyone know an easy way to delete duplicate items from a list?
>
This may not be the most efficient way, but anyway...
def remove_duplicates(aList):
newList = []
for item in aList:
if not (item in newList):
newList.append(item)
return newList
--
Tony Ingraldi
A.M.INGRALDI@LaRC.NASA.GOV
Phone : (757) 864-3039
Fax : (757) 864-7892