Reputation: 2071
I'm trying to convert a json
table to a csv file but the problem is that when a field contains the delimiter character it gets copied just the same and it can cause some interpretation problems later on. Is there an option in csv.writer
to remove delimiter characters inside the fields if they are present ? Or at least brace the field with quotes I guess.
Upvotes: 0
Views: 1535
Reputation:
Try passing
quoting=csv.QUOTE_ALL
to the csv.writer
constructor. That will force the library to quote all fields.
Here is a link to the documentation for the quoting
parameter and the link to the documentation for csv.QUOTE_ALL
.
Upvotes: 2