标签:star int sleep nbsp range 方法 tip 方式 __name__
from multiprocessing import Process import time import random import queue import threading def aoo(ao): time.sleep(1) print("这是进程%s"%ao) if __name__ == "__main__": #创建进程方法一 for i in range(3): pro = Process(target=aoo,args=("aoo+",)) pro.start() #创建进程方法二 class MyProcess(threading.Thread): def __init__(self): super(MyProcess,self).__init__() def run(self): print(self.name) if __name__ == "__main__": for i in range(3): mp = MyProcess() mp.start()
标签:star int sleep nbsp range 方法 tip 方式 __name__
原文地址:https://www.cnblogs.com/TKOPython/p/12455132.html