Pull Last 3 Months
Paul Hankin
paul.hankin at gmail.com
Wed Oct 17 17:32:29 EDT 2007
More information about the Python-list mailing list
Wed Oct 17 17:32:29 EDT 2007
- Previous message (by thread): Pull Last 3 Months
- Next message (by thread): Pull Last 3 Months
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Oct 17, 9:59 pm, Harlin Seritt <harlinser... at yahoo.com> wrote: > Is there a module that can pull str values for say the last 3 months? > Something like: > > print lastMonths(3) > > ['Sep', 'Aug', 'Jul'] You should take a look at the 'datetime' module. You can get the current month: datetime.datetime.now().month And a list of all abbreviated month names: [datetime.datetime(1900, i + 1, 1).strftime('%b') for i in range(12)] >From there, it shouldn't be too tricky to construct the list of months you want. -- Paul Hankin
- Previous message (by thread): Pull Last 3 Months
- Next message (by thread): Pull Last 3 Months
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list