📜  如何在 pytho 中使循环计数秒 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:34.710000             🧑  作者: Mango

代码示例1
import time #import the necessary library

sec = 0 #define the varieble that will store the amount of seconds

while True:
    print(sec) #prints the seconds
    time.sleep(1) #time.sleep(amount of seconds) the delay
    sec = sec + 1 # adds the time passed to the counter