Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- File "exm0.py", line 14, in <module>
- cursor.execute("""INSERT INTO Employee VALUES({0}, {1})""".format(k, v))
- sqlite3.OperationalError: no such column: dani
- from user_names import *
- import sqlite3
- # user_names.py
- names = ["dani", "eric", "dinna", "tamir", "edan", "daniel", "tomer",
- "noa", "shalev", "tom", "shir"]
- phones = ["0432", "5415166255", "61467254", "6146758", "5889482"]
- connection = sqlite3.connect("")
- cursor = connection.cursor()
- cursor.execute("""CREATE TABLE Employee(Name text, Phone int)""")
- acc = {}
- for k, v in zip(names, phones):
- #acc[k] = v
- cursor.execute("""INSERT INTO Employee VALUES({0},
- {1})""".format(k, v))
- for k, v in zip(names, phones):
- #acc[k] = v
- cursor.execute("INSERT INTO Employee VALUES(?, ?)", (k, v))
- cursor.executemany("INSERT INTO Employee VALUES(?, ?)", zip(names, phones))
- for k, v in zip(names, phones):
- #acc[k] = v
- cursor.execute("INSERT INTO Employee (Name, Phone) VALUES(?,?)", (k, v))
- cursor.execute("INSERT INTO Employee VALUES(?, ?)", [k, v])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement