Q:

Python - Get output of all prints

I wrote a python script that has a lot of data prints to the user.
I now need to save all of the print statements to a single txt/csv file.
I wonder what is the fastest and most efficient way to achieve this.
I could do this for each row at the time but prefer to this once for the entire script.

A:

You can redirect the output:
Python script.py > file.csv

