python 时间 T 去掉 带上ms 毫秒 时间格式

import datetime
# 时间格式 .%f 毫秒
## "%Y-%m-%dT%H:%M:%S.%f"
# 格式 秒
## "%Y-%m-%dT%H:%M:%S"
# 格式 分钟
## "%Y-%m-%dT%H:%M"
# 将 字符串格式的时间,转成时间毫秒格式
update_time = datetime.datetime.strptime(i["UpdatedAt"][:26], "%Y-%m-%dT%H:%M:%S.%f")
# 将时间格式转成 字符串
update_time = update_time.strftime('%Y-%m-%d %H:%M:%S.%f')
发布了157 篇原创文章 · 获赞 85 · 访问量 34万+

猜你喜欢

转载自blog.csdn.net/Areigninhell/article/details/103145669