Cameron Walsh schrieb:
> 
> If it's on linux you can just redirect the screen output to a file:
> 
> python initialfile.py 1>stdout.txt 2>stderr.txt


> As for windows, I'll test it now...
> 
> It turns out you can at least redirect the output to a file, I'm not
> sure what it does with standard error or even if it exists or not.
> 
> python initialfile.py > output.txt
> 
> should work.

 >cmd
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

 >type output.py
import sys

print 'This is print.'
sys.stdout.write('This is stdout.write()\n')
sys.stderr.write('This is stderr.write()\n')

 >python output.py 1>stdout.txt 2>stderr.txt

 >type stdout.txt
This is print.
This is stdout.write()

 >type stderr.txt
This is stderr.write()

Seems on XP it works too.

Leonhard
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to