Answers for "def restart program()"

1

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

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)
Posted by: Guest on November-27-2020
2

how to restart program in python

import os
import sys
os.execl(sys.executable, sys.executable, *sys.argv)
Posted by: Guest on November-30-2020

Code answers related to "def restart program()"

Python Answers by Framework

Browse Popular Code Answers by Language