How to get a readable "script" output?
When I run a python script I wa开发者_JAVA技巧nt to capture everything which is output on the screen. When I use the "script" command and capture the log in "typescript" file, the output in not readable when using vi. Its readable using
Try:
python -u yourscript.py 1> log 2> err
Or for appending
python -u yourscript.py 1>> log 2>> err
./pyscript.py &> output.txt
or:
python script.py &> output.txt
Note: redirects both stdout and stderr to output.txt.
精彩评论