소스 검색

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 키 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


불러오는 중...
취소
저장