gpt4 book ai didi

python - mysql-python fetchrow 带来: TypeError: 'long' object is not callable

转载 作者:行者123 更新时间:2023-11-30 23:34:22 26 4
gpt4 key购买 nike

我有一张 table :

+-----------+-------------+------+-----+---------+-------+| Field     | Type        | Null | Key | Default | Extra |+-----------+-------------+------+-----+---------+-------+| Benutzer  | varchar(50) | YES  |     | NULL    |       || Confirmed | tinyint(1)  | YES  |     | NULL    |       |+-----------+-------------+------+-----+---------+-------+

with one entry!

If I execute on the mysql console in a shell:

select Benutzer from UserConfirm where Benutzer = '\{\'gid\'\:\ \'tamer\'\,\ \'uid\'\:\ \'tamer\'\}'

有效!

在 mysql-python 中出现错误消息:

TypeError: 'long' object is not callable

我做错了什么?!这是我的 Python 代码:

cursor = self.__db.cursor().execute('select * from UserConfirm where Benutzer = \'' + ds + '\'') 
return cursor().fetchrow()

如有任何建议,我将非常感谢。

最佳答案

问题是你存储的不是游标对象,只是execute的返回值,不是游标,应该是:

cursor = self.__db.cursor()
cursor.execute('select * from UserConfirm where Benutzer = \'' + ds + '\'')
return cursor.fetchone()

关于python - mysql-python fetchrow 带来: TypeError: 'long' object is not callable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8868408/

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