redirect python output to file

C++
$ python foo.py > file
Source

Also in C++: