Answer the question
In order to leave comments, you need to log in
How to write a list using streams?
hello world.
from time import sleep
from threading import Thread
all_id = [('0',), ('1',), ('2',), ('3',), ('4',), ('5',), ('6',), ('7',)]
def potok(num):
if True:
if num == 1:# ПОТОК 1
for x in all_id:
print(x[0])
sleep(0.5)
elif num == 2:# ПОТОК 2
for x in all_id:
print(x[0])
sleep(0.5)
thread1 = Thread(target=potok, args=( 1,))
thread2 = Thread(target=potok, args=( 2,))
thread2.start()
thread1.start()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question