python3.4中的buffer()内置函数错误

时间:2016-05-20 18:02:08

标签: python python-3.x

我有一个基本上通过从" where.data"中获取位置来创建数据库的代码。文件然后与base_url正确连接以点击googlemaps api。初始代码是用python 2.7编写的,我对特定的代码行有错误 `

fh = open("where.data")
count = 0
for line in fh:
    if count > 200 : break
    address = line.strip()
    print ('')
    cur.execute("SELECT geodata FROM Locations WHERE address=?",repr(memoryview(buffer(address))), ))

    try:
        data = cur.fetchone()[0]
        print ("Found in database ",address)
        continue
    except:
        pass

代码最初只使用(buffer(address),)。它显示的错误是:enter image description here

0 个答案:

没有答案