📜  os.execl(sys.executable, sys.executable, *sys.argv) - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:00.683000             🧑  作者: Mango

代码示例1
import os
import sys

restart = input("\nDo you want to restart the program? [y/n] > ")

if restart == "y":
    os.execl(sys.executable, os.path.abspath(__file__), *sys.argv) 
else:
    print("\nThe program will be closed...")
    sys.exit(0)