Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含 4 列的 sqlite 表,例如:id、pagenr、x1、y1。我需要将 y1 列值作为列表/元组获取,但只能从 pagenr 和 x1 具有特定值的行中获取。帮助很大。注意:我使用的是 python 2.6。
使用 sqlite3 模块的这段代码应该将查询结果的行提取到output列表中:
output
conn = sqlite3.connect('database.db') c = conn.cursor() c.execute('select y1 from table where pagenr=? and x1=?', (pagenr_value, x1_value)) output = c.fetchall()