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