아래 예는 my_func() 이 1초단위로 무한 반복 실행됨.
# 파이썬 타이머 활용예
import threading
def my_func():
print('my_func')
# 인자1. 초단위시간. 인자2. 해당시간시 수행할 함수. start() 호출이후 인자1의 시간 이후 콜백으로 등록해둔 my_func() 실행됨.
threading.Timer(1,my_func).start()
my_func()
연관
Python . 스레드 . 함수 , 클래스
파이썬 함수 를 스레드로 실행. - 아래 코드에서 my_thread.start() 실행하면 함수 my_function 이 스레드로 실행된다. import threading def my_function(): while True: print('endless') my_thread = threading..
igotit.tistory.com
첫 등록 : 2021.09.16
최종 수정 :
단축 주소 : https://igotit.tistory.com/2917
댓글