我試圖運行多個腳本,我有一個主腳本,我只是用名稱替換並運行。配置線程或多處理運行多個腳本python
的穿線方法我想要這個樣子的
from threading import Thread
import sys
sys.path.append('/python/loanrates/master')
names = ['BTS', 'ETH', 'CLAM']#, 'DOGE', 'FCT', 'MAID', 'STR', 'XMR', 'XRP' ]
threads = []
for name in names:
sys.path.append('/python/loanrates/'+name)
import Master
for name in names:
T = Thread(target=Master.main(name))
print T
threads.append(T)
for thread_ in threads:
thread_.start()
for thread_ in threads:
thread_.join()
但是,這只是開始的第一個腳本,即名「BTS」
的利用多重名字似乎簡單得多,但這時間它不認識池
import multiprocessing
import Master
pool = Pool(processes= 2)
names = ['BTS', 'ETH']#, 'CLAM', 'DOGE', 'FCT', 'MAID', 'STR', 'XMR', 'XRP' ]
pool.map(Master.main(), names)
你會推薦哪個,我需要改變代碼以使其工作?