import os
class StrToCode:
def __init__(self):
self.file = open('codestr.py', 'w')
def add_row(self, row):
self.file.write(row + '\n')
def run(self):
self.file.close()
os.system("python codestr.py")
def str_to_code(s):
li = s.split('\n')
S = StrToCode()
for i in li:
S.add_row(i)
S.run()