Module 13
Export results
Saving the output.
Export
Save the results table to a CSV file.
import csv
results = [{"id": "Tv01", "gc": 54.2}]
with open("final.csv", "w", newline="") as f:
writer = csv.DictWriter(f, fieldnames=["id", "gc"])
writer.writeheader()
writer.writerows(results)
print("Exported")Your task
Export
- Export results to CSV.