Back to index

python3.2  3.2.2
executemany_2.py
Go to the documentation of this file.
00001 import sqlite3
00002 
00003 def char_generator():
00004     import string
00005     for c in string.letters[:26]:
00006         yield (c,)
00007 
00008 con = sqlite3.connect(":memory:")
00009 cur = con.cursor()
00010 cur.execute("create table characters(c)")
00011 
00012 cur.executemany("insert into characters(c) values (?)", char_generator())
00013 
00014 cur.execute("select c from characters")
00015 print(cur.fetchall())