I have a list and I'm trying to do a loop for each item in the list, all at the same time.
I've tried using this code:
thelist = ['first', 'second', 'third']
def loop():
while True:
for x in thelist:
x = str(x)
time.sleep(5)
do_stuff_that_includes_x()
But it does the stuff in the loop one by one as sorted in thelist
.
And I want it to do the stuff for all items in thelist
at the same time.
Thanks in advance.