Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import data to sqlite db test.db
- import sqlite3 as lite
- import sys
- con = lite.connect('test.db')
- with con:
- cur = con.cursor()
- cur.executescript('drop table if exists Names;')
- cur.execute("CREATE TABLE Names(Id INT PRIMARY KEY, Name TEXT);")
- with open('file.txt') as f:
- for line in f:
- line.strip()
- print line
- cur.execute('INSERT INTO Names(Name) VALUES(?)', line)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement