{"action":"created","issue":{"url":"https://api.github.com/repos/training-nlp-noob/knock100/issues/8","labels_url":"https://api.github.com/repos/training-nlp-noob/knock100/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/training-nlp-noob/knock100/issues/8/comments","events_url":"https://api.github.com/repos/training-nlp-noob/knock100/issues/8/events","html_url":"https://github.com/training-nlp-noob/knock100/issues/8","id":78396096,"number":8,"title":"Q40-49 コメントとかなんでも","user":{"login":"cipron81","id":10508002,"avatar_url":"https://avatars.githubusercontent.com/u/10508002?v=3","gravatar_id":"","url":"https://api.github.com/users/cipron81","html_url":"https://github.com/cipron81","followers_url":"https://api.github.com/users/cipron81/followers","following_url":"https://api.github.com/users/cipron81/following{/other_user}","gists_url":"https://api.github.com/users/cipron81/gists{/gist_id}","starred_url":"https://api.github.com/users/cipron81/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cipron81/subscriptions","organizations_url":"https://api.github.com/users/cipron81/orgs","repos_url":"https://api.github.com/users/cipron81/repos","events_url":"https://api.github.com/users/cipron81/events{/privacy}","received_events_url":"https://api.github.com/users/cipron81/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":24,"created_at":"2015-05-20T06:34:12Z","updated_at":"2015-06-12T23:26:31Z","closed_at":null,"body":"./data/neko.txt.cabocha は\r\n``` sh\r\ncabocha < neko.txt > neko.txt.cabocha\r\n```\r\n\r\n./data/neko.txt.f1.cabocha は\r\n``` sh\r\ncabocha -f1 < neko.txt > neko.txt.f1.cabocha\r\n```\r\nで作成しました。 (どちらもMac"},"comment":{"url":"https://api.github.com/repos/training-nlp-noob/knock100/issues/comments/111640686","html_url":"https://github.com/training-nlp-noob/knock100/issues/8#issuecomment-111640686","issue_url":"https://api.github.com/repos/training-nlp-noob/knock100/issues/8","id":111640686,"user":{"login":"notani","id":1850199,"avatar_url":"https://avatars.githubusercontent.com/u/1850199?v=3","gravatar_id":"","url":"https://api.github.com/users/notani","html_url":"https://github.com/notani","followers_url":"https://api.github.com/users/notani/followers","following_url":"https://api.github.com/users/notani/following{/other_user}","gists_url":"https://api.github.com/users/notani/gists{/gist_id}","starred_url":"https://api.github.com/users/notani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/notani/subscriptions","organizations_url":"https://api.github.com/users/notani/orgs","repos_url":"https://api.github.com/users/notani/repos","events_url":"https://api.github.com/users/notani/events{/privacy}","received_events_url":"https://api.github.com/users/notani/received_events","type":"User","site_admin":false},"created_at":"2015-06-12T23:26:31Z","updated_at":"2015-06-12T23:26:31Z","body":"@kunisawa-fc さん\r\n\r\n確かに以下のコードですと、二回目が表示されません。\r\n```python\r\nimport urllib.request\r\nf = urllib.request.urlopen(\"http://www.cl.ecei.tohoku.ac.jp/nlp100/data/hightemp.txt\")\r\nfor line in f:\r\n    print(\"1\")\r\nfor line in f:\r\n    print(\"0\")\r\nf.close()\r\n```\r\n一回目の`for line in f`が終わった時点でファイルポインタ（今から読もうとしている行の位置と思ってください）が末尾に行きます。その後もう一度読もうとしても、「そのポイント以降に入力できる行はない」となってしまうわけです。\r\n\r\nファイルポインタを再び先頭に戻すためには、`f.seek(0)`を使います。\r\n```python\r\nimport urllib.request\r\nf = urllib.request.urlopen(\"http://www.cl.ecei.tohoku.ac.jp/nlp100/data/hightemp.txt\")\r\nfor line in f:\r\n    print(\"1\")\r\nf.seek(0)\r\nfor line in f:\r\n    print(\"0\")\r\nf.close()\r\n```"}}