python3的sqlite3模块怎样删除整个数据表?
importsqlite3con=sqlite3.connect('test1.db')try:con.execute('createtablepeople(name,p...
import sqlite3
con=sqlite3.connect('test1.db')
try:
con.execute('create table people (name,phone,city)')
except:
pass
con.execute('insert into people values ("toby","555-1212","Boston")')
con.commit()
cur=con.execute('select * from people')
print(cur.__next__())
然后我想把整个表test1.db都删除(而不是只删除其中的记录),应该怎么写? 展开
con=sqlite3.connect('test1.db')
try:
con.execute('create table people (name,phone,city)')
except:
pass
con.execute('insert into people values ("toby","555-1212","Boston")')
con.commit()
cur=con.execute('select * from people')
print(cur.__next__())
然后我想把整个表test1.db都删除(而不是只删除其中的记录),应该怎么写? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询