timeLen = "100分钟"
if "分钟" in timeLen:
timeLen = int(timeLen.replace("分钟", ""))
hour = str(timeLen // 60)
minutes = str(timeLen % 60) if len(str(timeLen % 60)) == 2 else ("0" + str(timeLen % 60))
timeLen = ":".join((hour, minutes, "00"))
本文介绍了一种将时间长度从分钟转换为小时、分钟和秒的算法。通过解析字符串,去除单位,并进行数学运算,最终得到标准的时间格式。
1959

被折叠的 条评论
为什么被折叠?



