{"author_url":"https://blog.hatena.ne.jp/xkumiyu/","provider_url":"https://hatena.blog","blog_url":"https://www.kumilog.net/","categories":["Python","\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0"],"html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.kumilog.net%2Fentry%2Funicode-decode-error\" title=\"Python 3\u3067\u30d5\u30a1\u30a4\u30eb\u8aad\u307f\u8fbc\u307f\u6642\u306eUnicodeDecodeError\u3092\u56de\u907f\u3059\u308b - kumilog.net\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","height":"190","author_name":"xkumiyu","image_url":"https://cdn-ak.f.st-hatena.com/images/fotolife/x/xkumiyu/20171101/20171101232418.jpg","version":"1.0","url":"https://www.kumilog.net/entry/unicode-decode-error","provider_name":"Hatena Blog","width":"100%","published":"2017-10-22 00:30:00","type":"rich","description":"Python\u3067\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3080\u3068\u304d\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u51e6\u7406\u3067\u3044\u3051\u307e\u3059\u304c... with open('file/to/path', 'r') as f: for line in f: line = line.strip() # \u3064\u3065\u304d\u306e\u51e6\u7406 \u8aad\u307f\u8fbc\u3093\u3067\u3044\u308b\u9014\u4e2d\u3067\u3001utf-8\u3067\u306f\u306a\u3044\u6587\u5b57\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u3068\u3001UnicodeDecodeError\u304c\u767a\u751f\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002for line in f\u306e\u884c\u3067\u767a\u751f\u3057\u307e\u3059\u3002 \u5927\u304d\u306a\u30d5\u30a1\u30a4\u30eb\u3001\u7279\u306b\u3069\u3053\u304b\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u5834\u5408\u3001\u3069\u306e\u6587\u5b57\u304cutf-8\u3067\u306f\u306a\u3044\u306e\u304b\u3001\u7279\u5b9a\u3059\u308b\u3053\u3068\u304c\u96e3\u3057\u3044\u3067\u3059\u3002 UnicodeDecodeError: 'utf-8' codec c\u2026","blog_title":"kumilog.net","title":"Python 3\u3067\u30d5\u30a1\u30a4\u30eb\u8aad\u307f\u8fbc\u307f\u6642\u306eUnicodeDecodeError\u3092\u56de\u907f\u3059\u308b"}