importing csv file into sqlite

Peter Otten __peter__ at web.de
Thu Dec 18 04:28:08 EST 2008


Chris Rebert wrote:

>> klia wrote:

>> for item in input:
>>        curse.execute('INSERT INTO photos VALUES (?,?,?,?)',item)

> I believe you need to change 'item' to '*item' to expand the list in
> the call so that the function gets 4 additional args rather than 1
> additional arg that happens to be a list. But as I've never used the
> DB-API before, this is just a guess.

No, the execute() method call is correct. There must be a malformed row in
the csv with only one field.

Peter




More information about the Python-list mailing list