[last updated: 2019-10-28]
go to: Python home page
go to: Python Programming
go to: Python Libraries:
go to: Python: Importing Libraries:
go to: Python: Functions & Importing
go to: Python: Error Handling
-----
-
- Redirecting output to a file:
- Any output that your python file produces, eg. print statements,
can be redirected to a file.
That is, instead of the output going to the terminal, it will write to a file.
- If running your file from a command line terminal, syntax is:
$ sudo python [path/filename.py] > [output path/filename.txt]
(the .txt extension is nominal, since the file will Be a text file, but could optionally be any or no extension)
- Every time you execute such a redirected program, a new output file will be created.
That is, if you're using the same output filename, then whatever was in any already existing file will be over-written the next time your redirection is executed
.
.
.
eof