"Use the source, Luke."
In this case, the module of interest is csv. We don't need the source here. Normally you would use it something like this:
csv.readeris initialized with a file object (what I learned to call a file "handle"), for which I typically use the variable name
FH. But it will also work with data. So we can use it as shown here:
We should have done
strip()on the data before
split(), that will get rid of the extra element which is preserved as an empty list in the output. csv also has cool
I don't know a way to get
DictWriterto write the header. I guess you'd just do it separately with
FH.write()when the file is first opened.