redirect python output to a file shell code example
Example 1: redirect python output to file
$ python foo.py > file
Example 2: linux echo redirect output to python script
import sys
data = sys.stdin.readlines()
$ python foo.py > file
import sys
data = sys.stdin.readlines()