I want to execute python code from txt file and store it.
In txt file I have this code:
def func(a):
return a
In python:
def random_file_input(file_name):
ran_number = random.randint(0, 100)
with open(file_name, 'r+') as f:
data = f.read()
f.write(f"\nfunc({ran_number})")
a = exec(data) #-----> i want to store like this :(
random_file_input('python_code.txt') ```