Python Neustart das Skript
sys.stdout.flush()
os.execl(sys.executable, 'python', __file__, *sys.argv[1:])
Long Lobster
sys.stdout.flush()
os.execl(sys.executable, 'python', __file__, *sys.argv[1:])
import os
import sys
os.execl(sys.executable, sys.executable, *sys.argv)
import os
while 1:
os.system("python main.py")
print "Restarting..."
exit()
#our code
var = input("Hi! I like cheese! Do you like cheese?").lower()
if var == "yes":
print("That's awesome!")
# using While True
while True: # Will keep going untill told not to using 'break'
var = input("Hi! I like cheese! Do you like cheese?").lower()
if var == "yes":
print("That's awesome!")
os.execv(sys.executable, ['python'] + sys.argv)
def restart():
import sys
print("argv was",sys.argv)
print("sys.executable was", sys.executable)
print("restart now")
import os
os.execv(sys.executable, ['python'] + sys.argv)