Redirecting the Output Stream : redirect « File « Python Tutorial






import sys
sys.stdout = open('log.txt', 'a')      

print 1








12.13.redirect
12.13.1.Redirecting the Output Stream
12.13.2.The print >> file Extension