gpt4 book ai didi

python sql fetchone 没有弹出它。

转载 作者:行者123 更新时间:2023-11-29 00:28:21 25 4
gpt4 key购买 nike

如何在不将其从列表中删除的情况下使用 python fetchone() 调用。

如果我这样做:

while True:
print cur.fetchone()

每一行都是下一行。

我怎样才能做类似的事情

cur.fetchone(pop=False) # so it doesnt remove it from the list as Im just testing something and I will actually fetch that row later. 

基本上。我需要取一行。检查里面的东西。如果匹配,则弹出列表并对该行执行操作。否则。继续前进。

最佳答案

你不能。先存储返回值即可:

while True:
result = cur.fetchone()
if result is not None:
# do something.

关于python sql fetchone 没有弹出它。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17859817/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com