can we save print msg into a file when script running ?

Fredrik Lundh fredrik at pythonware.com
Wed Oct 12 11:51:04 EDT 2005


Steve Holden wrote:

>> what does 2>&1 mean pls ?
>>
> It's Unix shell-speak for "send the standard error stream to the same
> place as the standard output". Probably a syntax error on Windows ...

> more test.py
import sys
sys.stdout.write("stdout!\n")
sys.stderr.write("stderr!\n")

> python test.py >out
stderr!

> python test.py 2>out
stdout!

> python test.py >out 2>&1
>more out
stdout!
stderr!

> ver
Microsoft Windows XP [Version 5.1.2600]

</F> 






More information about the Python-list mailing list