CSVs are kinda bad. We know this, but sometimes it’s helpful to remember why they’re kinda bad. Maybe you need to work with CSVs and you’re using Python, because Python is kinda good. And someone else somewhere wrote a CSV: import csv data = [ ['Name', 'Comment'], ['Alice', 'She said, "Hello" and waved.'], ] with open('/tmp/data.csv', 'w', newline='') as file: writer = csv.writer(file, quoting=csv