簡體   English   中英

找出對象的可能屬性

[英]figuring out the possible attributes of an object

關於來自python-blogger的代碼

def listposts(service, blogid):
    feed = service.Get('/feeds/' + blogid + '/posts/default')
    for post in feed.entry:
        print post.GetEditLink().href.split('/')[-1], post.title.text, "[DRAFT]" if is_draft(post) else ""

我想知道feed.entry存在哪些字段,但不確定在這些文檔中查找的位置。

所以我不只是想要一個答案。 我想知道我應該如何瀏覽文檔以自己了解。

嘗試dir(field.entry)可能對您的情況有用。

這是逐步解決問題的一種情況。

我要做的第一件事是在您發送的鏈接上單擊服務...基於service = feed.Get(...)

通往此處的網址http : //gdata-python-client.googlecode.com/hg/pydocs/gdata.service.html

然后看.Get()它指出

Returns:
  If there is no ResultsTransformer specified in the call, a GDataFeed 
  or GDataEntry depending on which is sent from the server. If the 
  response is niether a feed or entry and there is no ResultsTransformer,
  return a string. If there is a ResultsTransformer, the returned value 
  will be that of the ResultsTransformer function.

因此,猜測您有一個GDataFeed-對其進行迭代:,而一個用於“ google GDataFeed”的快速Google會導致: https : //developers.google.com/gdata/jsdoc/1.10/google/gdata/飼料

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM