import threading
import time
def ford():
for i in range(10):
print('dd')
time.sleep(1)
def fords():
for i in range(10):
print('ddddd')
time.sleep(1)
def main():
t1 = threading.Thread(target = ford)
t2 = threading.Thread(target = fords)
t1.start()
t2.start()
while True:
print((threading.enumerate()))
if __name__ == '__main__':
main()
import threading
num = [100,200]
def test1(temp):
temp.append(20)
print(temp)
def test2(temp):
print(temp)
def main():
t1 = threading.Thread(target = test1 , args = (num,))
t1.start()
t2 = threading.Thread(target = test2 , args = (num,))
t2.start()
print(num)
if __name__ == '__main__':
main()
|