如何正确解决win10系统下C盘空间不能扩展的问题!

时间:2024-11-11 07:05:08
【python】SQLite学习笔记04:占位符?的陷阱

Joy of Fire: 可以替代列名: Iterable[dict[str, Any]] 类型的值传入当占位符替代值,占位符这么写:'INSERT INTO employee (:name, :sex)'。官方文档写了啊,你是不是没有仔细看。 我抄了一部分官方文档(/zh-cn/3/library/#how-to-use-placeholders-to-bind-values-in-sql-queries): con = (":memory:") cur = ("CREATE TABLE lang(name, first_appeared)") # This is the named style used with executemany(): data = ( {"name": "C", "year": 1972}, {"name": "Fortran", "year": 1957}, {"name": "Python", "year": 1991}, {"name": "Go", "year": 2009}, ) ("INSERT INTO lang VALUES(:name, :year)", data) # This is the qmark style used in a SELECT query: params = (1972,) ("SELECT * FROM lang WHERE first_appeared = ?", params) print(())