-1

i'm currently solving optimization problems with python. One problem takes about 5hrs to solve which result will appear (sadly) in console but not completely since it's a very big list. I'm wondering right now if there is anyway to get the solution of the list completely while i'm waiting for the results (i've been waiting for 4hrs. now).

If there is a way i can get the complete result in the console after the code has runned, let me know. If there is a way via console to put the results in a .txt file or any type of readable file afterwards please let me know.

If there is no solution to this problem, let me know.

Thanks alot.

3 Answers3

2

say your script is called yourscript.py and you have been running it in the console with: python yourscript.py

if you use this command:

python yourscript.py > newfile.txt

all of the output will go into newfile.txt

perry
  • 61
  • 5
0

Suppose your python file is myfile.py, in order to redirect what is printed in this file run your file as:

python myfile.py > myfile.txt

Your printed list will be printed in myfile.txt.

rodgdor
  • 2,530
  • 1
  • 19
  • 26
0

pipe it into a file with the format you want for example your file name is xyz.py

In your python shell

 python xyz.py > myfile.txt

Your output will now be in myfile.txt

Chetan_Vasudevan
  • 2,414
  • 1
  • 13
  • 34