簡體   English   中英

重啟 python 中的整個腳本

[英]Restart the whole script in python

有沒有辦法重新啟動 python 中的腳本。 這是我嘗試過的方式,但它只是在一段時間后卡住了。 當我使用os.excelos.excev它不起作用它只是返回一個錯誤

os.system("start cmd /c python" + __file__)

所以,我需要做的是讓這個 function 重新啟動腳本

def main():
  os.system("start cmd /c python" + __file__)

如果有人知道答案,請幫忙

使用這樣的循環

while True:
  #Your code here

continue

continue 將從while True:

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM