thank you everybody for your help! That worked perfectly. :) I really
appreciate the time you spent answering what is probably a pretty basic
question for you. It's nice not to be ignored.
be well,
-matt
--
http://mail.python.org/mailman/listinfo/python-list
Simon Forman wrote:
>
> Do ','.join(clean) to make a single string with commas between the
> items in the set. (If the items aren't all strings, you'll need to
> convert them to strings first.)
>
And if the items themselves could contain commas, or quote characters,
you might like to look at the
[EMAIL PROTECTED] wrote:
> Hello,
>
> I have some lists for which I need to remove duplicates. I found the
> sets.Sets() module which does exactly this
I think you mean that you found the sets.Set() constructor in the set
module.
If you are using Python 2.4, use the built-in set() function instead
[EMAIL PROTECTED] wrote:
> 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'
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 co
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('cl