sqlite básico

import sqlite3
connect = sqlite3.connect('url-nb.db')
cur = connect.cursor()
cur.execute('drop table if exists url')
cur.execute('''create table url (id integer primary key,
                                url text,
                                title text)''')
for line in lines:
    cur.execute('insert into url (url) values (?)', (line.strip(),))
cur.execute('select url from url')
rows = cur.fetchall()
print(len(rows))
print(rows)
Allen Chiu