Skip to content

Instantly share code, notes, and snippets.

@atsuya046
Created December 20, 2013 11:17
Show Gist options
  • Save atsuya046/8053450 to your computer and use it in GitHub Desktop.
Save atsuya046/8053450 to your computer and use it in GitHub Desktop.
sqliteのクエリを組み立てるとき、配列の長さの分だけ"?"を作る
for row in csv.reader(data):
params = ', '.join(map(lambda s: '?', row))
c.execute('''insert into %s values (%s) ''' % (table_name, params), row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment