There\'re lots of print function (python 2.7) in my program. Is there any way I can add a few lines then all the output can be redirected to
print
python 2.7
In python 2.7 you can do:
import sys print >> sys.stderr, "To stderr."
Or you can import the behavior from 3.x:
from __future__ import print_function import sys print('To stderr.', file=sys.stderr)