首页
it技术
登录
6mi
u
盘
搜
搜 索
it技术
Python将浮点类型的分钟数转换成为时分秒
Python将浮点类型的分钟数转换成为时分秒
it
2023-07-18
69
Python将浮点类型的分钟数转换成为时分秒
def transform_time(seconds): # 得到总秒数 seconds = float(seconds)*60 m, s = divmod(seconds, 60) h, m = divmod(m, 60) time = "%d小时%02d分钟%02d秒" % (h, m, s) return time # 此处的19.05单位为分钟 print(transform_time(19.05)) # 0小时19分钟03秒
转载请注明原文地址: https://lol.8miu.com/read-7059.html
最新回复
(
0
)