print shell output in a file

Juho Schultz juho.schultz at pp.inet.fi
Fri Jun 30 14:03:22 EDT 2006


Juergen Huber wrote:
> hello,
>
> one more question i will have!
>
> now i have written a little programm, which delivers me an output on the
> shell!
>

>
> Is there a way to put this output in an file?!?! i searched about 2h for
> this, but i couldn`t find an answer!
>
> thnks, juergen

Others have suggested creating a file.

You could also let the shell to do the work.

If you run the program "normally", output goes to screen:
python myprog.py

Run and redirect the output to a file:
python myprog.py > output_of_myprog.txt

This also makes controlling the output filename much easier.

You could find the following useful:
http://www.swc.scipy.org/lec/shell01.html




More information about the Python-list mailing list