On Fri, Mar 6, 2009 at 7:24 AM, <jyoun...@kc.rr.com> wrote: > Just curious if this is the best way to get the first 3 letters of the > current month? > >>>> import datetime >>>> >>>> d = datetime.date.today() >>>> m = d.strftime("%B")[:3].upper() >>>> m > 'MAR'
I believe you want the lowercase version, "%b" (Locale’s abbreviated month name): >>> import datetime >>> datetime.date.today().strftime("%b") 'Mar' Cheers, Chris -- I have a blog: http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list