# 想利用多核cpu,那麼就使用多進程import multiprocessingimport timeimport threadingdef run2(): print('這是多線程啓動的')def run(): time.sleep(2) print('多進程') for j in range(5): t = threading.Thread(target=run2) t.start()if __name__ == '__main__': for i in range(5): p = multiprocessing.Process(target=run) p.start()