I have a python script that contains a function update and it displays the results in the terminal but the old value has been cleared. I want to keep all the values thank you
Asked
Active
Viewed 32 times
1 Answers
2
For your python script foo.py
, run it as
python foo.py > output.txt
this will save the output of foo.py
in the file output.txt
. See this thread.
EDIT
As mentioned in the comments, >
will create a new output file everytime, overwriting any previous file with the same name. If you wish to append the output, use >>
.

Divyanshu Srivastava
- 1,379
- 11
- 24
-
1Single `>` will cause the file to being rewritten each time the output is redirected. `>>` ensures that the output is appended. – balkon16 May 21 '19 at 12:08