我希望能够使用变量从数据库中获取值,最后一行是我要实现的目标。class Data(db.Model): property = db.StringProperty()data = Data(property = 'value')data.put()query = db.GqlQuery("SELECT * FROM Data")myvar = 'property'for line in query: line[myvar]
1 回答
侃侃尔雅
TA贡献1801条经验 获得超16个赞
谢谢voscausa,
class Data(db.Model):
property = db.StringProperty()
data = Data(property = 'value')
data.put()
query = db.GqlQuery("SELECT * FROM Data")
myvar = 'property'
for line in query:
getattr(line, myvar)
添加回答
举报
0/150
提交
取消