summaryrefslogtreecommitdiffstats
path: root/Doc/lib/sqlite3/executemany_2.py
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/lib/sqlite3/executemany_2.py')
-rw-r--r--Doc/lib/sqlite3/executemany_2.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Doc/lib/sqlite3/executemany_2.py b/Doc/lib/sqlite3/executemany_2.py
new file mode 100644
index 0000000..05857c0
--- /dev/null
+++ b/Doc/lib/sqlite3/executemany_2.py
@@ -0,0 +1,15 @@
+import sqlite3
+
+def char_generator():
+ import string
+ for c in string.letters[:26]:
+ yield (c,)
+
+con = sqlite3.connect(":memory:")
+cur = con.cursor()
+cur.execute("create table characters(c)")
+
+cur.executemany("insert into characters(c) values (?)", char_generator())
+
+cur.execute("select c from characters")
+print cur.fetchall()