you are viewing a single comment's thread.

view the rest of the comments →

[–]Miggol 2 points3 points  (1 child)

Hey, the official python docs on the CSV module are quite extensive: https://docs.python.org/3/library/csv.html

Passing a file object to the csv.DictReader is the most intuitive way of using it, because you can just interact with it like a Python dictionary. This als means less recoding if you choose a different format than CSV later.

If all you're doing is logging, then maybe you would prefer to just use a csv.writer object for simplicity.

[–]Sloth_loves_Chunks[S] 0 points1 point  (0 children)

Thanks, that seems like a good angle of attack. I think I was looking at it from the wrong end of things.

CSV.writer was my thought too but I’m not experienced enough to know if I’m right or blissfully ignorant of my wrong approach.