{"categories":["Python"],"provider_url":"https://hatena.blog","provider_name":"Hatena Blog","author_name":"kagasu","url":"https://kagasu.hatenablog.com/entry/2018/09/11/120758","author_url":"https://blog.hatena.ne.jp/kagasu/","image_url":null,"description":"\u2160. \u306f\u3058\u3081\u306b \u3053\u306e\u8a18\u4e8b\u3067\u306fPython\u6a19\u6e96\u306emimetypes\u3067\u306f\u7121\u304f\u3001libmagic\u306e\u30e9\u30c3\u30d1\u30fc\u3067\u3042\u308bpython-magic\u3092\u5229\u7528\u3057\u305f\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002 \u2161. \u74b0\u5883 Python 3.7.0 Windows 10 64bit 1709 \u2161. \u3084\u308a\u65b9 1. \u5fc5\u8981\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b python-magic-bin \u306fWindows\u306e\u307f\u5fc5\u8981\u3067\u3059 pip3 install python-magic pip3 install python-magic-bin 2. \u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u66f8\u304f import magic print(magic.from_file('a.pdf')) prin\u2026","blog_url":"https://kagasu.hatenablog.com/","blog_title":"\u5099\u5fd8\u9332","published":"2018-09-11 12:07:58","height":"190","version":"1.0","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fkagasu.hatenablog.com%2Fentry%2F2018%2F09%2F11%2F120758\" title=\"Python\u3067\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\u3084MIME\u3092\u53d6\u5f97\u3059\u308b\uff08libmagic\u306e\u30e9\u30c3\u30d1\u30fc\u3092\u4f7f\u3046\u65b9\u6cd5\uff09 - \u5099\u5fd8\u9332\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","type":"rich","width":"100%","title":"Python\u3067\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\u3084MIME\u3092\u53d6\u5f97\u3059\u308b\uff08libmagic\u306e\u30e9\u30c3\u30d1\u30fc\u3092\u4f7f\u3046\u65b9\u6cd5\uff09"}