Last active
May 10, 2016 16:10
-
-
Save nwiizo/42f4b862c3a1bc9c4a3174393c27d8b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from io import StringIO | |
with open("jawiki-country.json",'rt') as f: | |
#日本語処理は面倒なのでtオプションをつけてバイナリモードとして扱います。 | |
for l in f: | |
data01 = json.load(StringIO(l)) | |
#ファイルのように文字列を読み書きする. | |
if data01["title"] == "イギリス": | |
#タイトルからイギリスの部分のみをdata02に出力する。 | |
data02 = data01["text"] | |
print(data02) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##というファイルが生成されました。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment