removing duplicates, or, converting Set() to string
bearophileHUGS at lycos.com
bearophileHUGS at lycos.com
Wed Jul 26 19:52:12 EDT 2006
The write accepts strings only, so you may do:
out.write( repr(list(clean)) )
Notes:
- If you need the strings in a nice order, you may sort them before
saving them:
out.write( repr(sorted(clean)) )
- If you need them in the original order you need a stable method, you
can extract the relevant code from this large blob:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/438599
Bye,
bearophile
More information about the Python-list
mailing list