看板 Python 關於我們 聯絡資訊
小弟剛入門python沒多久 我現在在寫一個爬蟲的東西,處理過程有點複雜,資料量又大,想導入多進程加快速度 我是用進程池pool,但是看網路上的教學好像通過apply_async執行的task只能接收一個引數的樣子 前面有幾個task需要用到的資料已經處理好了,但我不知道怎麼丟進去,有高手能交流一下嗎? 範例: def task: (do somthing) main:(主程式) a(陣列) b(陣列) c(Beautifulsoup) job = [pool.apply_async(task, (d,)) for d in xxx] 我想把a,b,c這三個每個task都會用的資料丟進task,要怎麼做比較好? ----- Sent from JPTT on my Sony F8332. -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.160.164.203 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1517382507.A.8F3.html
anotherday: functool partial 01/31 16:11
Yshuan: 推partial 01/31 16:25
king00000000: 嗯嗯,套進去了,這個真好用,感謝1、2樓 01/31 19:17
ar54971: https://goo.gl/2WCUGr 03/06 03:44
galeondx: https://goo.gl/cybm9m 03/06 04:22
galeondx: https://goo.gl/MKaCK6 03/06 04:34