Skip to content

Instantly share code, notes, and snippets.

@nwiizo
Last active May 10, 2016 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nwiizo/42f4b862c3a1bc9c4a3174393c27d8b2 to your computer and use it in GitHub Desktop.
Save nwiizo/42f4b862c3a1bc9c4a3174393c27d8b2 to your computer and use it in GitHub Desktop.
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)
##というファイルが生成されました。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment