Possible Duplicate:
python csv reader behavior with None and empty string
When reading in a csv file, the reader reads None
or NULL
as (u'')
. This is causing me problems when inserting values into a sqlite database and performing queries as all null values are stored as empty strings. Is there a way of using the reader to insert nulls? What I have so far is:
reader = csv.reader(open(filename))
curs.executemany("INSERT INTO mytable VALUES (?,?,?,?)", reader)