python——多进程
作者:互联网
#并行:真的多任务,任务数小于cpu核数
#并发:假的多任务,任务数大于cpu核数
import threading
import time
def sing():
for i in range(5):
print("singing")
time.sleep(1)
def Dance():
for i in range(5):
print("Dance")
time.sleep(1)
def main():
t1=threading.Thread(target=sing)
t2=threading.Thread(target=Dance)
t1.start()#启动线程,即让线程开始执行
t2.start()
if __name__=="__main__":
main()
标签:__,python,t1,Dance,time,进程,main,def 来源: https://www.cnblogs.com/shunguo/p/14477043.html