时间转换成时间戳
s = 'Fri Apr 26 22:35:25 +0800 2019'
ts = datetime.datetime.strptime(s, "%a %b %d %H:%M:%S %z %Y")
ts = int(ts.timestamp())
# 1556289325
常用格式符
常用格式符(续表)
s = 'Fri Apr 26 22:35:25 +0800 2019'
ts = datetime.datetime.strptime(s, "%a %b %d %H:%M:%S %z %Y")
ts = int(ts.timestamp())
# 1556289325
常用格式符
本文标题:python 时间转换成时间戳
本文链接:https://www.haomeiwen.com/subject/gjbvwqtx.html
网友评论