From 59369e3c35c2d25e96bbe290380f95d6a8ee5501 Mon Sep 17 00:00:00 2001 From: Shii Kayano Date: Fri, 26 Oct 2018 18:49:32 +1200 Subject: [PATCH] fix example: wrap dict.values in list() In Python 3, `dict.values` returns a dict_values object, which does not support indexing. --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 833ecea..9825938 100644 --- a/README.rst +++ b/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