sqlite3 scrapy

Chris Angelico rosuav at gmail.com
Thu Jul 7 10:26:58 EDT 2016


On Fri, Jul 8, 2016 at 12:04 AM,  <tokauf at gmail.com> wrote:
>  34                 sql = "INSERT INTO Frisch VALUES(" + unicode(counter) + ", " + "'" + el.strip() + "');"

Don't ever do this. Instead, use parameterized queries:

cur.execute("INSERT INTO Frisch VALUES (?, ?)", (counter, el.strip()))

>  38                 conn.commit

Do you know what this does?

>  39                 counter = int(counter)

This is unnecessary; counter is already an integer.

Does anything actually call your code? If not, none of the above will
matter. But possibly there's an invocation that I'm not seeing.

ChrisA



More information about the Python-list mailing list