how to redirect output of a python in file code example Example: redirect python output to file $ python foo.py > file