2024-04-19 07:09:43 发布
网友
这个问题与this SO非常相似,但我的数据如下表所示:
'13-04-2018 14:06:26.866' '13-04-2018 14:06:27.131' '13-04-2018 14:06:27.404' '13-04-2018 14:06:27.674' ...
即秒以小数形式给出。我对datetime documentation的阅读表明它不支持这种格式,所以我不确定如何最好地继续
看来你需要
.%f == Microsecond as a decimal number, zero-padded on the left.
Ex:
import datetime s = '13-04-2018 14:06:26.866' print(datetime.datetime.strptime(s, "%d-%m-%Y %H:%M:%S.%f"))
输出:
2018-04-13 14:06:26.866000
看来你需要
.%f == Microsecond as a decimal number, zero-padded on the left.
Ex:
输出:
相关问题 更多 >
编程相关推荐