Python mySql数据库在0x104e18ea0处有sqlite3.Cursor对象作为表中的输出

Python mySql数据库在0x104e18ea0处有sqlite3.Cursor对象作为表中的输出,python,mysql,database,sqlite,Python,Mysql,Database,Sqlite,我有一张名为rank的表 id Name 1 Roger 2 Tom 另一个名为PersonId的表。在这里,我试图在personId表中选择name并添加id def getRank(teamName): name = c.execute(ids = c.execute("SELECT id From rank where Name = '%s';" % Name) print "str val of rank: ",name.fetchall()[0]

我有一张名为rank的表

 id  Name 
 1    Roger
 2    Tom
另一个名为PersonId的表。在这里,我试图在personId表中选择name并添加id

def getRank(teamName):
    name = c.execute(ids = c.execute("SELECT id From rank where Name = '%s';" % Name)
    print "str val of rank: ",name.fetchall()[0][0],
    return str(name.fetchall()[0][0])
如果我输入“罗杰”,我期待

1
在公共线路界面中,我看到:

str val of rank:  1
但在数据库中,它以

“0x104e18ea0处的sqlite3.Cursor对象”

目前,PersonId表看起来像

id 
c、 执行(插入PersonId(id)值(?),[getRank('Roger'))

执行后,表如下所示:

    id
sqlite3.Cursor object at 0x104e18ea0
sqlite3.Cursor object at 0x104e18ea0
我不知道为什么我得到的是对象位置的地址而不是实际值

如果您有任何想法或帮助,我们将不胜感激

只需要改变一下:

str(name.fetchall()[0][0])
       to
name.fetchall()[0][0]

您的
getRank()
函数没有返回任何内容,因此我希望数据库值为
None
。我有这个,只是在复制粘贴时错过了那一行,我已经编辑了这个问题。