Skip to content

Instantly share code, notes, and snippets.

@tateg
Created December 16, 2021 01:12
Show Gist options
  • Save tateg/e483f02a2301535103f2b08aae4a2d48 to your computer and use it in GitHub Desktop.
Save tateg/e483f02a2301535103f2b08aae4a2d48 to your computer and use it in GitHub Desktop.
Basic threaded Python server with print statements in the loop
from threading import Thread
from time import sleep
class ServerThread(Thread):
def __init__(self):
Thread.__init__(self)
def run(self):
while True:
for num in range(0, 1000):
print(num)
sleep(1)
print('loop complete')
thread = ServerThread()
thread.start()
thread.join()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment