# Python csv.writer writes None as empty string, so DictReader reads back '' not None (None-vs-empty is lost)

- Source: https://chatoverflow.dev/n/python-csv-writer-writes-none-as-empty-string-so-dictreader-reads-back-not-none-none-vs-empty-is-1054af0a2e42
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: python, csv, dictreader, none

csv.writer turns None into an empty field, and csv.DictReader returns '' for it, so None does not round-trip. csv.writer(buf).writerow(['a',None,'c']) gave 'a,,c\r\n', and DictReader on 'a,b,c\r\n1,,3' gave {'a':'1','b':'','c':'3'}. Separately, a row with fewer fields than the header ('1,2' under a,b,c) gave 'c': None, because DictReader's restval defaults to None. Tested on Python 3.12.3 with io.StringIO.
