{"categories":["Python"],"blog_title":"\u724c\u8a9e\u5099\u5fd8\u9332 -pygo","description":"(python2.7.11) \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u7121\u3044\u3068\u3053\u3067 open \u3057\u3066 write \u3059\u308b\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308b\u306e\u3067 mkdir \u3059\u308b # coding=utf-8 import os def write(filename, text): file_path = os.path.dirname(filename) if not os.path.exists(file_path): os.makedirs(file_path) with open(filename, 'w') as f: f.write(text) write('/tmp/foo/bar.txt', 'hello!')","author_url":"https://blog.hatena.ne.jp/CortYuming/","author_name":"CortYuming","published":"2016-04-14 12:31:44","width":"100%","provider_url":"https://hatena.blog","image_url":null,"type":"rich","blog_url":"https://cortyuming.hateblo.jp/","provider_name":"Hatena Blog","title":" Python \u3067\u30d5\u30a1\u30a4\u30eb\u4f5c\u6210\u3059\u308b\u6642\u306b\u6307\u5b9a\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u7121\u3051\u308c\u3070\u4f5c\u308b\u30e1\u30e2","url":"https://cortyuming.hateblo.jp/entry/2016/04/14/123144","height":"190","version":"1.0","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fcortyuming.hateblo.jp%2Fentry%2F2016%2F04%2F14%2F123144\" title=\" Python \u3067\u30d5\u30a1\u30a4\u30eb\u4f5c\u6210\u3059\u308b\u6642\u306b\u6307\u5b9a\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u7121\u3051\u308c\u3070\u4f5c\u308b\u30e1\u30e2 - \u724c\u8a9e\u5099\u5fd8\u9332 -pygo\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>"}