import threading
import time
event=threading.Event()
def lighter():
counter=0
while True:
if counter>3 and counter<=6:
print("\33[1;41;m red")
time.sleep(1)
elif counter>6:
counter=0
else:
print("\33[1;42;m green")
time.sleep(1)
counter+=1
t1=threading.Thread(target=lighter)
t1.start()
线程:红绿灯
最新推荐文章于 2020-04-07 10:18:18 发布