Python threading minimal example
This minimal example shows how to create a thread that prints Hello world every second:
import threading
import time
def my_thread_func():
while True:
print("Hello world")
time.sleep(1)
my_thread = threading.Thread(target=my_thread_func)
my_thread.start()
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow