[Tutor] Redirecting output -- Thanks!

Rick Owen rickowen@yahoo.com
Mon Jun 16 22:40:03 2003


Thanks!  I knew it had to be simple.

Rick.

> 
> Actually it's simpler than that: you can just rebind sys.stdout and use
> vanilla print for all your output:
> 
> import sys
> 
> oldout = sys.stdout
> print 'redirecting'
> sys.stdout = open('c:/temp2/stuff','w')
> for i in range(10):
>     print i
> sys.stdout.close()
> sys.stdout = oldout
> print 'back to normal'
> 
> HTH,
> Don
> 



=====
French President Jacques Chirac met with President Bush in France Sunday. It is hard to exaggerate their mutual contempt. The last time two presidents were this angry at one another, only their daughter Chelsea could get them talking again.

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com