Python——秒数转时间

seconds=25643
m, s = divmod(seconds, 60)
h, m = divmod(m, 60)
print ("%02d:%02d:%02d" % (h, m, s))
print(f"Etc time: {
      
      int(h)}:{
      
      int(m)}:{
      
      int(s)}")

输出:

Etc time: 6:48:32

参考文章:

猜你喜欢

转载自blog.csdn.net/qq_45779334/article/details/124587517