En Wed, 17 Oct 2007 21:47:50 -0300, Tim Chase  
<[EMAIL PROTECTED]> escribió:

> In the event that you need them in whatever your locale is, you
> can use the '%b' formatting to produce them:

I prefer the calendar module in that case:

py> import locale
py> locale.setlocale(locale.LC_ALL, '')
'Spanish_Argentina.1252'
py>
py> import calendar
py> calendar.month_abbr[12]
'Dic'
py> def prev_months(since, howmany):
...   return [calendar.month_abbr[(since.month-i-2) % 12 + 1] for i in  
range(how
many)]
...
py> import datetime
py> prev_months(datetime.datetime(2005,2,10), 4)
['Ene', 'Dic', 'Nov', 'Oct']
py> prev_months(datetime.datetime(2005,10,17), 3)
['Sep', 'Ago', 'Jul']

-- 
Gabriel Genellina

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

Reply via email to