How can I redirect print function to an output file?

Alex Martelli aleaxit at yahoo.com
Sun Feb 26 15:11:19 EST 2006


<Plissken.s at gmail.com> wrote:

> I am using the print function in my python script.
> Can you please tell me what can I do to redirect the output to an file?

f = open('aaaaaaargh', 'w')
print>>f, 'killew wabbit'


Alex



More information about the Python-list mailing list