小知识

110 阅读1分钟
Python: 把epoch时间转换成字符串

(如果epoch时间单位是毫秒,需要将epoch时间除以1000变成以秒为单位。)

import timetime.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(epoch_time)) 
'2014-08-22 00:00:00'


python:科学计数法转化为浮点型数据

'{:.5f}'.format(1.2e-4)
result:'0.00012'