python 实现程序重启

def restart_program():

   """Restarts the current program. 

  Note: this function does not return. Any cleanup action (like 

  saving data) must be done before calling this function."""  

  python = sys.executable  

  os.execl(python, python, * sys.argv)  

 

 

原文地址:https://www.cnblogs.com/Adalia-Ting/p/8779961.html