+ 2

Does somebody has an idea how to make multiple lines-code-executer? This is my first-look try:

class Program(): def __init__(self): self.lines = list() while True: try: self.line = input() except: break self.lines.append(self.line) y = open("sample.py", "w") y.write(str(self.lines)) y.close() self.printer() self.coder() # THIS ONE UP HERE HAS TO GET MULTIPLE LINES AND WRITE THEM INTO A FILE CALLED SAMPLE.PY, BUT FOR NOW DOESN'T WORK # IF YOU WISH YOU CAN HELP ME AND WRITE ME A MESSAGE, ALSO MY EMAIL IS: petar_1v@abv.bg # THE IDEA IS TO SIMPLLIFY AND GET THIS CODE*** https://code.sololearn.com/c2bXngrT47Jt/#py ***A MUCH MORE BEAUTY def printer(self): y = open("sample.py", "r") print("This is Your Code:\n", y.read()) y.close() print(">>This is Your Code\'s Output:") def coder(self): try: def main2(): import sample main2() except: print(">>Sorry! Can\'t execute Your Code") def main(): Program() if __name__ == '__main__': main()

11th Aug 2017, 5:31 PM
Petar Ivanov
Petar Ivanov - avatar
1 Respuesta
+ 2
REVEALED!!! NEW WORKING VERSION: https://code.sololearn.com/cAPvEY2ty9el/#py
11th Aug 2017, 6:48 PM
Petar Ivanov
Petar Ivanov - avatar