时间函数(秒转为特定格式)

时间:2017-10-23 23:35:43   收藏:0   阅读:253
def make_readable(seconds):
    m, s = divmod(seconds, 60)
    h, m = divmod(m, 60)
    return ‘%02d:%02d:%02d‘ % (h,m,s)

 divmod函数:本函数是实现a除以b,然后返回商与余数的元组。

 

原文:http://www.cnblogs.com/dreamyu/p/7602889.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!