How to send output to file

Gerrit Holl gerrit at nl.linux.org
Tue Jan 21 10:23:53 EST 2003


A schreef op dinsdag 21 januari om 09:54:37 +0000:
> I use httplib module.
> By h.set_debuglevel(1) I start debugging but the output is written to DOS window.
> How can  I divert the output to file instead.
> Thank you for help.

You can assing to sys.stdout

import sys
sys.stdout = open("myfile.log", "w")

http://www.python.org/dev/doc/devel/lib/module-sys.html#l2h-315
http://www.python.org/dev/doc/devel/ref/print.html

yours,
Gerrit.

-- 
Asperger Syndroom - een persoonlijke benadering:
	http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
	http://www.sp.nl/





More information about the Python-list mailing list