import threading
import time
def a():
while 1:
for x in range(3):
print(x)
time.sleep(1)
def b():
while 1:
for y in range(4,6):
print(y)
time.sleep(1)
def c():
while 1:
for z in range(7,10):
print(z)
time.sleep(1)
aa = threading.Thread(target=a())
bb = threading.Thread(target=b())
cc = threading.Thread(target=c())
aa.start()
bb.start()
cc.start()
我的目的是 这三个线程启动后就一起同时运行。直到我手动关闭。
可是,现在它只是aa在运行,那两个执行。
这是怎么回事?
(如果函数里不加while那它们就依次运行一次就停了。
但我的目的是:三个线程启动后就一起同时运行。直到我手动关闭。)