1、轉化成時間格式
seconds =35400m, s = divmod(seconds, 60)h, m = divmod(m, 60)print("%d:%02d:%02d" % (h, m, s))
結果:9:50:00
2、轉化成日期時間格式
import timetimeArray = time.localtime(1462482700)#秒數otherStyleTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)print(otherStyleTime)
結果:2016-05-06 05:11:40
以上這篇python將秒數轉化為時間格式的實例就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持武林站長站。
新聞熱點
疑難解答