Checking each item in m.group()?

Gilles Ganault nospam at nospam.com
Mon Jun 2 18:42:18 EDT 2008


On Mon, 2 Jun 2008 12:06:21 -0700 (PDT), Matimus <mccredie at gmail.com>
wrote:
>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