mysql 没有long_TypeError:'long'对象没有MySQL的属性''

我试图从MySQL表中检索数据。在

我的代码def getData(self, ID):

#Load data from MySQL

query = 'SELECT * FROM goals WHERE ID = "%s"'% (ID)

try :

cursor.execute(query)

data = cursor.fetchone()

conn.commit()

except Exception as e:

raise e

data = False

if data is not False:

for row in data:

self.ID = row[0]

self.description = row[1]

self.imageID = row[2]

self.imageLink = row[3]

self.Location = row[4]

self.status = row[5]

self.publishID = row[6]

self.goardID = row[7]

self.LikesID = row[8]

self.createdDate = row[9]

self.createdTime = row[10]

self.hide = row[11]

x = newThink()

print x.create_New()

print x.goalID, x.subscriptionID, x.LikesID, x.goardID

see = x.addData('Just the Second', 'Nairobi', 89900845,'http://image.com/789900845')

print see

see = x.postData()

print see

see = x.getData(x.goalID)

print see

print "Now here is the formatted data../n"

print '........'

print x.description, x.Location, x.imageID, x.imageLink

错误:

TypeError:“long”对象没有属性“getitem”

这是我一直得到的错误。它会返回一个元组,所以我不太确定

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值