import os
import sys
def new_name():
a()
with open("test.txt", "a") as myfile:
myfile.write("import time \nfrom main import urli \nprint(urli) \ntime.sleep(2)")
file_oldname = os.path.join("test.txt")
file_newname_newfile = os.path.join("name.py")
try:
os.rename(file_oldname, file_newname_newfile)
except FileExistsError:
os.remove("name.py")
try:
os.remove("test.txt")
except FileNotFoundError:
pass
new_name()
os.system("name.py")
def a():
global urli
urli = "2"
new_name()
urli
def new_name():
a()
with open("test.txt", "a") as myfile:
myfile.write("import time \nfrom main import urli \nprint(urli) \ntime.sleep(2)")
file_oldname = os.path.join("test.txt")
file_newname_newfile = os.path.join("name.py")
try:
os.rename(file_oldname, file_newname_newfile)
except FileExistsError:
os.remove("name.py")
try:
os.remove("test.txt")
except FileNotFoundError:
pass
new_name()
os.system("name.py")
def a():
global urli
urli = "2"