python save sys stdout and display code example Example: redirect python output to file $ python foo.py > file