{"image_url":null,"url":"https://potisan-programming-memo.hatenablog.jp/entry/2021/09/05/231322","type":"rich","author_url":"https://blog.hatena.ne.jp/potisan/","author_name":"potisan","published":"2021-09-05 23:13:22","width":"100%","provider_url":"https://hatena.blog","categories":["Python 3"],"title":"Python3 \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u3092JSON\u3078\u51fa\u529b\u3059\u308b","provider_name":"Hatena Blog","version":"1.0","blog_url":"https://potisan-programming-memo.hatenablog.jp/","description":"\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u3092JSON\u3078\u51fa\u529b\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3067\u3059\u3002pathlib\u3001json\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002 \u3059\u3079\u3066\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u5217\u6319\u3059\u308b import json from pathlib import Path # \u30d5\u30a1\u30a4\u30eb\u540d\u3092\u53d6\u5f97\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30d1\u30b9 dir_path = Path(r\"C:\\Windows\") # \u4f5c\u6210\u3059\u308bJSON\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9 json_path = Path(\"test.json\") json_path.write_text(json.dumps([p.name for p in dir_path.glob(\"*\")])) JPEG\u30d5\u30a1\u30a4\u30eb\uff08*.jpg\uff09\u3092\u5217\u6319\u3059\u308b i\u2026","height":"190","blog_title":"potisan\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30e1\u30e2","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fpotisan-programming-memo.hatenablog.jp%2Fentry%2F2021%2F09%2F05%2F231322\" title=\"Python3 \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u3092JSON\u3078\u51fa\u529b\u3059\u308b - potisan\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30e1\u30e2\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>"}