Part 6/8:
However, the initial output might not meet our formatting expectations, appearing instead as independent lists. To remedy this, we will use Python's zip()
function to pair quotes and authors before printing them together.
Outputting Data to CSV
After running the initial code successfully, we will want to save our results. While initially set on a ten-line code limit, we'll need to extend our program a bit to allow for functionally saving extracted data as a CSV file.
To do this, we will import the csv
library, create a CSV file, and write headers and paired quote-author data into it as our script loops through the lists. Once executed, a new CSV file will be created in the script’s folder, which can be opened in any compatible program, such as Excel, for further analysis.