newbie:unique problem

Leeds, Mark mleeds at mlp.com
Thu Mar 17 20:08:09 CET 2005


I have a function uniqueList that is below :

 

Def uniqueList(origList):

 

    nodups= {}

    for temp in origList:

       nodups[temp]  = None

    returns nodups.keys()

 

When used in the following context :

 

industryList = uniqueList(jpbarradata[group])

 

where jpbarradata[group] might look like

 

["AAA BC",BBB KK","CCC TD","AAA KP","CCC TD"]

 

,the function works in the sense that it would return

 

["AAA BC","BBB KK","CCC TD",AAA KP"]

 

because CCC TD is duplicated.

 

But, I also want it to get rid of the AAA KP because

there are two AAA's even though the last two letters

are different. It doesn't matter to me which one

is gotten rid of but I don't know how to change

the function to handle this ? I have a feeling

it's not that hard though ? Thanks.

 

 

 

 

 

 

 

 

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20050317/1f05eb76/attachment.html>


More information about the Python-list mailing list