python怎么讓程序重復(fù)運(yùn)行

發(fā)布時(shí)間:2024-07-20
python讓程序重復(fù)運(yùn)行的方法:1、報(bào)錯(cuò)后,重新啟動(dòng)【.py】文件,繼續(xù)執(zhí)行;2、重復(fù)執(zhí)行本【.py】文件中的內(nèi)容;3、異常調(diào)用函數(shù)本身。
python讓程序重復(fù)運(yùn)行的方法:
方法一:
報(bào)錯(cuò)后,重新啟動(dòng).py文件,繼續(xù)執(zhí)行
while 1: run_ticker = 'python ticker.py' run_depth = 'python depth.py' run_depth_pct = 'python depth_pct.py' run_trade = 'python trade.py' os.system(run_depth_pct)方法二:
重復(fù)執(zhí)行本.py文件中的內(nèi)容
os.execvp(sys.executable, [sys.executable] sys.argv)或
python = sys.executable # 獲取當(dāng)前執(zhí)行python os.execl(python, python, *sys.argv) # 執(zhí)行命令方法三:
異常調(diào)用函數(shù)本身
def restart(): try: fun() except eoferror as e: print(e) finally: restart()相關(guān)學(xué)習(xí)推薦:python視頻教程
上一個(gè):kobold橢圓齒輪流量計(jì)特點(diǎn)說明及工作原理
下一個(gè):低溫冷卻液循環(huán)泵常見的故障及解決方法是什么?

草坪建植管理技術(shù)
QSE-12固相萃取儀
普洱茶膏是用生茶還是熟茶制作呢?
lumia手機(jī)怎么刷機(jī),NOKIA怎么刷機(jī)
有限責(zé)任公司的股權(quán)轉(zhuǎn)讓怎么做
350型絲網(wǎng)波紋和250Y波紋填料產(chǎn)品介紹
缸蓋超聲波清洗機(jī)的應(yīng)用
混凝土貫入阻力儀技術(shù)說明
瑞士BIENRI柱塞泵AKP103/105機(jī)械維護(hù)
瑞士abb復(fù)合空心絕緣子品牌72
十八禁 网站在线观看免费视频_2020av天堂网_一 级 黄 色 片免费网站_绝顶高潮合集Videos