注意
注意不足1秒的时间要
四舍五入到秒
,我使用的方法是round()
时间输出注意
高位补零
,即%02d
代码如下
def time():
content = map(int, raw_input().split(' '))
CLK_TCK = 100
if content[0] >= content[1]:
return
allSecond = round(float(content[1]- content[0]) / CLK_TCK)
time = [0, 0, 0]
i = 2
while allSecond > 60:
time[i] = allSecond % 60
allSecond = allSecond / 60
i = i - 1
time[i] = allSecond % 60
print "%02d:%02d:%02d"% (time[0], time[1], time[2])
if __name__ == '__main__':
time()