详解python中executemany和序列的使用方法
一 代码
import sqlite3
persons=[
("Jim","Green"),
("Hu","jie")
]
conn=sqlite3.connect(":memory:")
conn.execute("CREATE TABLE person(firstname,lastname)")
conn.executemany("INSERT INTO person(firstname,lastname) VALUES(?,?)",persons)
for row in conn.execute("SELECT firstname,lastname FROM person"):
print(row)
print("I just deleted",conn.execute("DELETE FROM person").rowcount,"rows")
二 运行结果
y ========
('Jim', 'Green')
('Hu', 'jie')
I just deleted 2 rows
以上就是python中executemany和序列的应用,如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
最后
以上就是灵巧凉面最近收集整理的关于详解python中executemany和序列的使用方法的全部内容,更多相关详解python中executemany和序列内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复