Hello,

I have some lists for which I need to remove duplicates. I found the
sets.Sets() module which does exactly this, but how do I get the set
back out again?

# existing input: A,B,B,C,D
# desired result: A,B,C,D

import sets
dupes = ['A','B','B','C','D']
clean = sets.Set(dupes)

out = open('clean-list.txt','w')
out.write(clean)
out.close

---
out.write(clean) fails with "TypeError: argument 1 must be string or
read-only character buffer, not Set" and out.write( str(clean) )
creates "Set(['A', 'C', 'B', 'D'])" instead of just A,B,C,D.

thanks in advance for your time,

-matt

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to