例:
import threading
from time import ctime,sleep
def func1():
while 1>0:
print (‘running func1 ‘+ctime())
sleep(3)
def func2():
while 1>0:
print (‘running func2 ‘+ctime())
sleep(5)
t1=threading.Thread(target=func1)
t2=threading.Thread(target=func2)
t1.start()
t2.start()
Recent Comments