1

Currently I am running a python code all day. And what it basically does is print a data frame on pycharm's Run tool window. The run tool window basically displays output generated by the application.

I want to know if its possible to save the entire output generated in one day to a txt file.

Thank yo for your time,

OPM_OK
  • 190
  • 1
  • 1
  • 11
  • 1
    Since the output is generated by the running Python code, it may be easier to save the output by creating a file to log your printed output - i.e. where you print output, you write it to your log file. – jrd1 Jun 13 '18 at 18:28
  • instead of saving printing, have you considered using logging module and output to a file? here is a simple example....https://pl.python.org/docs/lib/node294.html – Yikang Luo Jun 13 '18 at 18:29
  • you can also refer this [post](https://stackoverflow.com/questions/4675728/redirect-stdout-to-a-file-in-python) to redirect stdout to a file. – Yikang Luo Jun 13 '18 at 18:30

2 Answers2

1
$ python yourapp.py > output.txt
lpozo
  • 598
  • 2
  • 9
0

One can also save a script output to a file with PyCharm UI, for specific Run Configuration:

enter image description here

Pavel Karateev
  • 7,737
  • 3
  • 32
  • 59