novice question

James Stroud jstroud at mbi.ucla.edu
Fri Mar 11 19:13:05 EST 2005


from sets import Set
for akey in grp.keys():
  grp[akey] = list(Set(grp[akey]))

On Friday 11 March 2005 03:15 pm, Leeds, Mark wrote:
> I have a dictionary grp that has lists
>
> for each element ( excuse my terminology if it's
>
> incorrect).
>
>
>
> So gname might be automobiles, finance, construction etc
>
> and grp[gname] is a list and this list
>
> has elements that are strings
>
> such as ["AAA","BBB","AAA","CCC"]
>
>
>
> Is there a quick way to loop through
>
> the grp dictionary and reduce the lists
>
> so that each only contains unique elements ?
>
>
>
>                                      thanks

-- 
James Stroud, Ph.D.
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095



More information about the Python-list mailing list