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'

> And for extra credit, I need the string whose value is the set of all of
> the letters of months minus the first letter.

I'm sure there must be a cleaner way to do this, but it works:
>>> ''.join(set(''.join([s[1:] for s in calendar.month_abbr[1:]])))
'acbeglonprutvy'

> E.g., 'ADFJMONS', 'acbeglonprutvy'


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

Reply via email to