Need Help comparing dates

Ben Finney bignose+hates-spam at benfinney.id.au
Thu Jun 15 21:41:31 EDT 2006


Tim Chase <python.list at tim.thechases.com> writes:

> If you need to map the month-strings back into actual dates, you 
> can use this dictionary:
> 
>  >>> month_numbers = dict([(date(2006, m, 1).strftime("%b"), m) 
> for m in range(1,13)])

Or you can just use the same format codes to specify that
time.strptime() should do the parsing for you. (Which I remembered too
late for my initial reply.)

-- 
 \          "War is God's way of teaching geography to Americans."  -- |
  `\                                                   Ambrose Bierce  |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list