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.
在 Android 上,我非常习惯于使用 cursor.moveToLast() 来获取游标中的最后一项。但是,我似乎找不到 Python 的 SQLite 的等价物。是否有一个函数可以让我获取游标的最后一行?
我可以调用 cursor.fetchall() 并获取列表中的最后一项,但是还有比这更有效的方法吗?谢谢。
cursor.execute("SELECT * FROM table ORDER BY id DESC LIMIT 1") result = cursor.fetchone()