详解python中executemany和序列的使用方法
2017-08-12 11:36
776 查看
详解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中的sort方法使用详解
- Python中的choice()方法使用详解
- 详解Python中for循环的使用方法
- 详解Python中find()方法的使用
- 详解Python中的__new__()方法的使用
- python基础入门详解(文件输入/输出 内建类型 字典操作使用方法)
- Python中的rfind()方法使用详解
- Python中的localtime()方法使用详解
- 详解Python中expandtabs()方法的使用
- Python中的localtime()方法使用详解
- 详解Python中的strftime()方法的使用
- lambda表达式使用方法详解 分类: python 2013-03-15 10:58 396人阅读 评论(0) 收藏
- 详解Python中的type()方法的使用
- Python中的rjust()方法使用详解
- python BeautifulSoup使用方法详解
- 详解Python中for循环的使用方法
- python基础入门详解(文件输入/输出 内建类型 字典操作使用方法)
- 举例详解Python中的split()函数的使用方法
- Python中的rfind()方法使用详解
- python中的sort方法使用详解