python中的SQLite3-can';t输出
我对python中的SQL有一个问题,我只是创建了一个表,并希望将其打印出来。D:我在使用Python3.xpython中的SQLite3-can';t输出,sqlite,Sqlite,我对python中的SQL有一个问题,我只是创建了一个表,并希望将其打印出来。D:我在使用Python3.x import sqlite3 print ("-" * 80) print ("- Welcome to my Address Book -") print ("-" * 80) new_db = sqlite3.connect('C:\\Python33\\test.db') c = new
import sqlite3
print ("-" * 80)
print ("- Welcome to my Address Book -")
print ("-" * 80)
new_db = sqlite3.connect('C:\\Python33\\test.db')
c = new_db.cursor()
c.execute('''CREATE TABLE Students
(student_id text,
student_firstname text,
student_surname text,
student_DOB date,
Form text)
''')
c.execute('''INSERT INTO Students
VALUES ('001', 'John','Doe', '12/03/1992', '7S')''')
new_db.commit()
new_db.close()
input("Enter to close")
输出应为:
001 John Doe 12/03/1992 7S
表中的任何其他行,如果包含名字John或姓氏Foo,你会困惑到底是什么?如何打印?如何运行
SELECT
查询?我对如何打印表格感到困惑!你在问题中已经写了什么。请说得更具体些。
001 John Doe 12/03/1992 7S