Python日期转换

mit*_*mcc 0 python strptime

好的,我放弃了.Python版本2.7.2

>>> from datetime import datetime
>>> datestr = "2014-01-24"
>>> displaydateobj = datetime.date(datetime.strptime(datestr,'%Y-%d-%m'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\_strptime.py", line 328, in _strptime
data_string[found.end():])
ValueError: unconverted data remains: 4
Run Code Online (Sandbox Code Playgroud)

我错过了什么?我已经检查了strptime格式字符串十几次.

The*_*ude 7

应该是:

datetime.date(datetime.strptime(datestr,'%Y-%m-%d'))