瀏覽代碼

fix example: wrap dict.values in list()

In Python 3, `dict.values` returns a dict_values object, which does not support indexing.
tags/v0.5.2
Shii Kayano 5 年之前
committed by GitHub
父節點
當前提交
59369e3c35
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: 4AEE18F83AFDEB23
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. +1
    -1
      README.rst

+ 1
- 1
README.rst 查看文件

@@ -189,7 +189,7 @@ Python 3 code (via the API_)::
"rvprop": "content", "format": "json", "titles": title}
raw = urlopen(API_URL, urlencode(data).encode()).read()
res = json.loads(raw)
text = res["query"]["pages"].values()[0]["revisions"][0]["*"]
text = list(res["query"]["pages"].values())[0]["revisions"][0]["*"]
return mwparserfromhell.parse(text)

.. _MediaWiki: http://mediawiki.org


Loading…
取消
儲存