Created
January 30, 2018 21:35
-
-
Save isidroamv/bb4653cb28b1f12cc865cca9c102c4d0 to your computer and use it in GitHub Desktop.
A loop using Thread
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 | |
import random | |
import time | |
import requests | |
def send_configurations(n=1, n2=2): | |
time.sleep(random.randint(1, 10)) | |
print(n) | |
for n in range(10): | |
d = { | |
'n': n, | |
'n2': 1 | |
} | |
Thread(target=send_configurations, kwargs=(d)).start() | |
apps = [] | |
def printer(id): | |
for n in range(10): | |
print(id) | |
for n in range(4): | |
p = Thread(target=printer, args=(n,)) | |
apps.append((printer, p, "printer")) | |
p.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment