Let's so I have the following to requests urls in parallel:
def _target(url):
res = requests.get(url)
print (res)
return res
while True:
threads = [threading.Thread(target=_target, args=(url,)) for url in urls]
[thread.start() for thread in threads]
[thread.join() for thread in threads]
How can I read the output from the threads
array? Or, is it not possible directly, and I need to use something like a global variable or write to some form of shared file/memory/etc. ? What would be the proper way to do the above?