错误Python:时间数据'Oct 22 2019 12:58:45:196AM'与格式'%b%d%Y%H%H:%M:%S:%f%p'不匹配)

问题描述 投票:0回答:1

我正在尝试为数据框的列设置日期。但是我跳过了这个错误,我阅读了datetime的文档,但我不明白问题出在什么地方。

datetime.strptime('Oct 22 2019 12:58:45:196AM', '%b %d %Y %H:%M:%S:%f%p')
python python-3.x datetime-format
1个回答
0
投票
USE this one there is no need to any format
>>> from dateutil import parser
>>> s= '25 April, 2020, 2:50, pm, IST'
>>> parser.parse(s)
>>> datetime.datetime(2020, 4, 25, 14, 50)
© www.soinside.com 2019 - 2024. All rights reserved.