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

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -