Python 获取当前时间的时间戳

秒级

import time

now = time.time() #返回float数据
#  获取当前时间戳---秒级级
print(int(now))

毫秒级

import time

now = time.time() #返回float数据

#毫秒级时间戳
print(int(round(now * 1000)))

 

时间戳在线转换工具:

https://tool.lu/timestamp/

posted @ 2020-12-28 15:28  eosclover  Views(10991)  Comments(0Edit  收藏  举报