can we save print msg into a file when script running ?
steve at holdenweb.com
Wed Oct 12 09:13:12 CEST 2005
> hi all~
> in my .py file there are a few print to trace out some message and i
> wonder if we can save it into a specified file when that script get
> running. if so, i may just check that file to c how the script is
> running. can anyone show me a right direction ?
> one million tks~
On Unix platforms you can run your script with a redirection of the
python myscript.py > somefile.txt &
[The ampersand runs the command in the background]. Then you can monitor
the content of the output file with
tail -f somefile.txt
which will show you the last part of the file and further additions as
long as you let the tail command run.
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/
More information about the Python-list