📜  python time.sleep 慢 - Python 代码示例

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

代码示例1
from time import perf_counter as timer
import time
from ctypes import windll #new

timeBeginPeriod = windll.winmm.timeBeginPeriod #new
timeBeginPeriod(1) #new

start = timer()
for i in range(1000):
    print (i)
    time.sleep(0.001)

end = timer()
print ("Total time: ", end - start)