Python datetime.strptime() 值错误
Python datetime.strptime() ValueError
我不明白为什么我使用 datetime.strptime() 时会出现此错误,这不应该匹配吗?
ValueError: time data '2018-02-01 15:09:02.487779' does not match format '%Y-$m-$d %H:%M:%S.%f'
最小的例子是:
from datetime import datetime
print(datetime.strptime('2018-02-01 15:09:02.487779', '%Y-$m-$d %H:%M:%S.%f'))
提前致谢!
您的部分格式字符串中有美元符号而不是百分号:
print(datetime.strptime('2018-02-01 15:09:02.487779', '%Y-$m-$d %H:%M:%S.%f'))
^ ^
我不明白为什么我使用 datetime.strptime() 时会出现此错误,这不应该匹配吗?
ValueError: time data '2018-02-01 15:09:02.487779' does not match format '%Y-$m-$d %H:%M:%S.%f'
最小的例子是:
from datetime import datetime
print(datetime.strptime('2018-02-01 15:09:02.487779', '%Y-$m-$d %H:%M:%S.%f'))
提前致谢!
您的部分格式字符串中有美元符号而不是百分号:
print(datetime.strptime('2018-02-01 15:09:02.487779', '%Y-$m-$d %H:%M:%S.%f'))
^ ^