나는 내 작업 pc에 작은 타이머를 코딩하려고했다. 우스운 점은 카운터가 너무 느려서 실행 시간이 오래 걸린다는 것입니다. 나는 정말로 혼란 스럽다. 업데이트 간격이 짧을수록 지연은 커집니다. 내 PC가 너무 느린가요? 이 CPU를 실행하는 동안 CPU는 약 30 %입니다 ... idk. python3.6.3Python Counter too slow
import time
def timer(sec):
start = sec
print(sec)
while sec > 0:
sec = sec-0.1 #the smaller this value, the slower
time.sleep(0.1)
print(round(sec,2))
print("Done! {} Seconds passed.".format(start))
start = time.time() #For Testing
timer(10)
print(time.time()-start)
당신을 기다리는 것이 좋습니다 또한 스케줄러를 보길 원할 수도 있습니다. https://docs.python.org/3.6/library/sched.html –