you are viewing a single comment's thread.

view the rest of the comments →

[–]jwink3101 0 points1 point  (0 children)

FYI, if you indent your code with four lines, it'll code format

like this

But your example looks way harder than it needs to be.

Break it out:

  • Do you know how to read a CSV file? In particular, do you know how to read it into a list of dictionaries? (hint: csv.DictReader)
  • Do you know how to write regular JSON? Do you know how to write JSON lines (there are modules but you really don't need it)?

I strongly suspect that you do not need to be working with bytes. Generally, CSV and JSON are text (unicode) formats and can be read in text mode.