Checking each item in

Gilles Ganault nospam at
Tue Jun 3 00:42:18 CEST 2008

On Mon, 2 Jun 2008 12:06:21 -0700 (PDT), Matimus <mccredie at>
>Here is a brief example. Note that this code is very insecure and
>susceptible to a SQL injection attack. Hopefully these csv files are
>from a trusted source.

Yes they are, and this script will only run on my PC, so it doesn't
need to be more secure than this.

>sql = "INSERT INTO mytable (col1, col2) VALUES ('%s','%s')"%tuple(
>        (c, "NULL")[c == ''] for c in m.groups()
>        )

I don't understand this syntax :-/

>Also, check out the csv module for parsing your csv file.

Will do. Thank you.

More information about the Python-list mailing list