I have a Python file test.py
and its output is 5 lines. I want to redirect the output (these 5 lines) into a log file.
Is there a way to run the test.py
and redirect directly the output as a log-file (test.log) in Python?
So if I have:
print(blabla)
print(blablo)
Then the test.log
will look like:
09/03/20 15:23:56:019 blabla
09/03/20 15:23:56:067 blablo