我數據存在leancloud裡面,要用python做個查詢,比如我知道一個人員的名字,想查詢他的年齡,我看了leancloud的官方文檔的查詢:
1:
from leancloud import Object
from leancloud import
QueryGameScore = Object.extend('GameScore')query = Query(GameScore)
query.equal_to('playerName', 'Dan Stemkoski')
gameScores = query.first()
print gameScores
輸出的是一個
<leancloud.object_.GameScore object at 0xb75072cc>,
不知道如何讀取這個數據的內容
2:然後我看有個select
GameScore = Object.extend('GameScore')
query = Query(GameScore)
query.select('score', 'playerName')
仍然返回
<leancloud.object_.GameScore object at 0xb75072cc>
3 然後試了一下fetch(),返回的是None,我確定表裡是有數據的。
GameScore = Object.extend('GameScore')
query = Query(GameScore)
query.select('score', 'playerName')
print query.first().fetch()
請問該如何寫代碼,能像select age from people where name = ‘Jim’一樣返回一個字段信息?
from leancloud import Object
from leancloud import
QueryGameScore = Object.extend('GameScore')
query = Query(GameScore)
query.equal_to('playerName', 'Dan Stemkoski')
gameScores = query.first()
print gameScores.get('score')