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
Post a Comment