1

该程序运行良好,但它没有在数据库中插入任何内容。我不明白!

import sqlite3 as db

conn = db.connect('C:\\SQLite\\test.db')
cursor = conn.cursor()

answer = "ok"

while answer != "":

    title = raw_input("Enter film: ")
    year = raw_input("Enter year: ")
    director = raw_input("Enter director: ")

    cursor.execute("insert into films (title, year, director) values (?, ?, ?)", (title, year, director))

    answer = raw_input("Continue?  ")

conn.close()
4

0 回答 0