用python每分钟打印一条消息

2024-09-26 18:01:51 发布

您现在位置:Python中文网/ 问答频道 /正文

我正努力每分钟给终端打印一条消息。我不能使用睡觉时间()因为还有其他事情需要继续运行。以下是我目前所掌握的情况,但我确信这样做有更合理的理由

startTime = time.time()
.
..
...
code to run other things
...
..
.     
endTime= time.time()
epochTime = int(endTime - startTime)

print ('epochTime: ' + str(epochTime))


if (epochTime % 60):
    print ('A minute has passed')

请给我建议一下我的最佳课程


Tags: torun终端消息time情况code事情

热门问题