【发布时间】:2013-08-24 12:50:13
【问题描述】:
from datetime import datetime
datetime.strptime('%b%d %I:%M%p', 'AUG21 3:26PM')
results with
1900-08-21 15:26:00
我怎样才能以pythonic方式编写,以便在没有年份时,将当前年份作为默认年份(2013)?
我检查了 strftime 函数没有更改默认值的选项。也许其他时间库可以做?
谢谢
【问题讨论】: