Created
December 16, 2021 01:12
-
-
Save tateg/e483f02a2301535103f2b08aae4a2d48 to your computer and use it in GitHub Desktop.
Basic threaded Python server with print statements in the loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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