I am trying to save printed output of a python cell to a text file but I also want to view the output in the cell. Is there a way to do this with out doubling up on the print function?
ex:
f = open("text.txt", "a")
print("Hello World!")
print("Hello World!", file = f)
f.close()