我希望能够使用变量从我的数据库中获取值,最后一行是我想要实现的。
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]
答案 0 :(得分:1)
谢谢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)