看板 Python 關於我們 聯絡資訊
目前需要使用到 multiprocessing 我要做到的是 開啟多個process 分別將資料進行 排序 排序法 def xxxxxSort( data_list ): #略 return sorted 目前找到的資料是用 multiprocessing.Pool 我可以用 multiprocessing.Pool 來達到 多process 執行 function ( print something) 但是我一直無法取到我 執行完 xxxxxSort 之後回傳的list 不過我有得到一些東西 像是 <multiprocessing.pool.ApplyResult object at 0x02716310> 請問有辦法使用 multiprocessing 來達到 多process 排序&回傳嗎 還是要透過 object at 0x02716310 來取得 list? 請求各路高手解答 -- ◢◤ ███◣ /// /// ███ ███ ███ ███ █▆▆ █▆▆ ██████◤ ψjimbox -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.166.145.1 ※ 文章網址: http://www.ptt.cc/bbs/Python/M.1396541882.A.49E.html
LarryPage:p=multiprocessing.Pool(100) 04/04 00:49
LarryPage:output_list = p.map(XXXXsort, input_list) 04/04 00:50
LarryPage:print output_list 04/04 00:51
LarryPage:[[1,4,5],[2,3],[7,9]] 04/04 00:51
LarryPage:有錯請指定 04/04 00:51
tiefblau:call .get()才會是函式的回傳值 話說樓上你有一百核嗎? 04/04 01:02
redbxh:1f 那樣寫是一百核還是允許最大100個process同時? 04/04 01:18
redbxh:感謝1F 方法可行 3Q 04/04 03:18
hsnu114444:100個process 04/25 22:55