Преглед изворни кода

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
No known key found for this signature in database 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…
Откажи
Сачувај