Dumping and loading with CSV
csv module encodes and decodes simple
dict instances into the CSV notation. As with the
json module, discussed previously, this is not a very complete persistence solution. The wide adoption of CSV files, however, means that it often becomes necessary to convert between Python objects and CSV.
Working with CSV files involves a manual mapping between our objects and CSV structures. We need to design the mapping carefully, remaining cognizant of the limitations of the CSV notation. This can be difficult because of the mismatch between the expressive powers of objects and the tabular structure of a CSV file.
The content of each column of a CSV file is—by definition—pure text. When loading data from a CSV file, ...