[問題] 同時執行多條程式碼

看板Python作者 (沙羅是轉換後的文字檔打m)時間6年前 (2019/01/31 22:55), 6年前編輯推噓1(101)
留言2則, 2人參與, 6年前最新討論串1/1
因為Python是直譯式,所以要一條程式碼執行完畢才會繼續執行下一條 如果有兩條不同的程式要同時執行 是不是只能透過import threading或multiprocessing才能實現? 還有其他Python原生的方法嗎? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 209.107.216.163 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1548946505.A.B28.html

01/31 23:00, 6年前 , 1F
asyncio
01/31 23:00, 1F
謝謝,我研究看看。 ※ 編輯: shala (209.107.216.163), 02/01/2019 00:25:51

02/02 02:00, 6年前 , 2F
在比較吃 IO 的 case, 可以考慮用 gevent 會簡單得多
02/02 02:00, 2F
謝謝,我研究看看! ※ 編輯: shala (209.107.216.199), 02/03/2019 11:21:13
文章代碼(AID): #1SKmn9ie (Python)
文章代碼(AID): #1SKmn9ie (Python)