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.
我不知道我做错了什么,但我的数据库没有更新!这就是我正在做的,很简单:
conn = sqlite3.connect('tarefas.db') c = conn.cursor() c.execute("UPDATE tarefas SET concluido = 1") conn.commit conn.close()
我想更新此列中的所有行。当我在 sqlite 管理器中执行此查询时,它可以工作。为什么python不能?
您错过了conn.commit通话中的括号。尝试这个:
conn.commit
conn = sqlite3.connect('tarefas.db') c = conn.cursor() c.execute("UPDATE tarefas SET concluido = 1") conn.commit() conn.close()