Printing stdout while also printing to a text file in python -


is there way print stdout while @ same time printing text file? example:

import sys sys.stdout = open('file.txt', 'w') #the stuff below should printed out , @ same time being printed text file print "this in text file , stdout" 

so, once again, there way this? or can not done?

if in script, have @ unix command tee. allow split stdout 2 directions, 1 goes file, , 1 continues stdout


Comments

Popular posts from this blog

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

php - Redirect and hide target URL -