v04 update 02
This commit is contained in:
parent
f34e708f9a
commit
9598792780
|
@ -14,10 +14,9 @@ def is_time(preTime):
|
|||
|
||||
# 时间格式化
|
||||
def time_format(preTime):
|
||||
is_time(preTime)
|
||||
m, s = divmod(preTime, 60)
|
||||
h, m = divmod(m, 60)
|
||||
s = round(s, 3)
|
||||
is_time(preTime) # 判断时间格式
|
||||
m, s = divmod(preTime, 60) # 获取秒
|
||||
h, m = divmod(m, 60) # 获取时、分
|
||||
|
||||
if (0 < s < 1):
|
||||
time_str = f'{s:.3f}秒'
|
||||
|
@ -45,11 +44,6 @@ def time_format(preTime):
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# time_test = 0.52362
|
||||
# time_test = 50
|
||||
# time_test = 90
|
||||
# time_test = 5000
|
||||
# time_test = 3600*24 + 1000
|
||||
|
||||
time_format(0.52362)
|
||||
time_format(50)
|
||||
|
|
Loading…
Reference in New Issue