我有以下格式的字符串日期数据:
4/16/15 23:50
Run Code Online (Sandbox Code Playgroud)
当我尝试转换为datetime对象时:
print datetime.datetime.strptime(fecha2, '%d/%m/%y %H:%M')
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
ValueError: time data '4/16/15 23:50' does not match format '%d/%m/%y %H:%M'
Run Code Online (Sandbox Code Playgroud)
根据这个列表:https: //docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior,我使用的格式正确.我哪里错了?
你有月和日扭转:
print datetime.datetime.strptime(fecha2, '%m/%d/%y %H:%M')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7828 次 |
| 最近记录: |