Python threading minimal example
This minimal example shows how to create a thread that prints Hello world every second:
example.py
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()
Check out similar posts by category:
Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow