我正在分析一些具有闰秒时间戳datetime2012-06-30T23:59:60.209215
的数据。我使用以下代码解析该字符串并将其转换为datetime对象:
nofrag, frag = t.split('.')
nofrag_dt = datetime.datetime.strptime(nofrag, "%Y-%m-%dT%H:%M:%S")
dt = nofrag_dt.replace(microsecond=int(frag))
Python文档声称这不应该是一个问题,因为%S
接受{
谢谢
这样做:
输出为:
^{pr2}$The documentation for ^{} says :
时间字符串
"2012-06-30T23:59:60.209215"
表示时间以UTC表示(它是当前的最后一个闰秒):相关问题 更多 >
编程相关推荐