PageRenderTime 21ms CodeModel.GetById 17ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/Doc/includes/sqlite3/executemany_2.py

http://unladen-swallow.googlecode.com/
Python | 15 lines | 11 code | 4 blank | 0 comment | 2 complexity | 0717c019409e9592c979752a0e040271 MD5 | raw file
 1import sqlite3
 2
 3def char_generator():
 4    import string
 5    for c in string.letters[:26]:
 6        yield (c,)
 7
 8con = sqlite3.connect(":memory:")
 9cur = con.cursor()
10cur.execute("create table characters(c)")
11
12cur.executemany("insert into characters(c) values (?)", char_generator())
13
14cur.execute("select c from characters")
15print cur.fetchall()