Re: I need a string/list/generator/comprehension incantation.

2007-04-20 Thread Scott David Daniels
Steven W. Orr wrote: > I really tried. I give up. > > I got this one last time (for which I'm very grateful). > ... Now I want something that's going to give me a string whose value is the > set of all of the first letters of months. Order is not important. > > And for extra credit, I need the s

Re: I need a string/list/generator/comprehension incantation.

2007-04-20 Thread Jerry Hill
On 4/20/07, Steven W. Orr <[EMAIL PROTECTED]> wrote: > I really tried. I give up. > > Now I want something that's going to give me a string whose value is the > set of all of the first letters of months. Order is not important. >>> ''.join(set([s[0] for s in calendar.month_abbr[1:]])) 'ADFJMONS'

Re: I need a string/list/generator/comprehension incantation.

2007-04-20 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Steven W. Orr wrote: > Now I want something that's going to give me a string whose value is the > set of all of the first letters of months. Order is not important. "".join(set(m[0] for m in calendar.month_abbr[1:])) > And for extra credit, I need the string whose

I need a string/list/generator/comprehension incantation.

2007-04-20 Thread Steven W. Orr
I really tried. I give up. I got this one last time (for which I'm very grateful). import calendar months = dict([(month,ii) for ii,month in enumerate(calendar.month_abbr)][1:]) Now I want something that's going to give me a string whose value is the set of all of the first letters of months. O