0

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()
Luke R
  • 1
  • You might want to check out the Logger. [(1)](https://stackoverflow.com/questions/14906764/how-to-redirect-stdout-to-both-file-and-console-with-scripting) – Jiho Choi Aug 16 '21 at 16:16

0 Answers0