{"id":44121,"date":"2025-08-06T18:49:15","date_gmt":"2025-08-06T09:49:15","guid":{"rendered":"https:\/\/techgym.jp\/?p=44121"},"modified":"2025-08-06T18:49:19","modified_gmt":"2025-08-06T09:49:19","slug":"python-pathlib-directory","status":"publish","type":"post","link":"https:\/\/techgym.jp\/column\/python-pathlib-directory\/","title":{"rendered":"Python pathlib\u3067\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\uff08\u30d5\u30a9\u30eb\u30c0\uff09\u306e\u4f5c\u6210\u30fb\u524a\u9664\u3092\u884c\u3046\u65b9\u6cd5"},"content":{"rendered":"\n<p>\u00a0<\/p>\n<h2>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4f5c\u6210<\/h2>\n<h3>mkdir() &#8211; \u57fa\u672c\u7684\u306a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4f5c\u6210<\/h3>\n<pre><code class=\"language-python\">from pathlib import Path\n\n# \u5358\u4e00\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4f5c\u6210\nnew_dir = Path('new_folder')\nnew_dir.mkdir()\n\n# \u65e2\u5b58\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u3042\u308b\u5834\u5408\u306f\u30a8\u30e9\u30fc\u3092\u7121\u8996\nnew_dir.mkdir(exist_ok=True)\n<\/code><\/pre>\n<h3>\u968e\u5c64\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4f5c\u6210<\/h3>\n<pre><code class=\"language-python\">from pathlib import Path\n\n# \u89aa\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3082\u540c\u6642\u306b\u4f5c\u6210\ndeep_dir = Path('data\/2024\/january\/reports')\ndeep_dir.mkdir(parents=True, exist_ok=True)\n\n# Windows\u5f62\u5f0f\u306e\u30d1\u30b9\u3067\u3082\u540c\u69d8\nwin_path = Path('C:\/Users\/user\/Documents\/MyProject\/data')\nwin_path.mkdir(parents=True, exist_ok=True)\n<\/code><\/pre>\n<h3>\u6a29\u9650\u3092\u6307\u5b9a\u3057\u3066\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4f5c\u6210<\/h3>\n<pre><code class=\"language-python\">from pathlib import Path\nimport stat\n\n# Unix\u7cfbOS\u3067\u306e\u6a29\u9650\u6307\u5b9a\nsecure_dir = Path('secure_folder')\nsecure_dir.mkdir(mode=0o700, exist_ok=True)  # \u30aa\u30fc\u30ca\u30fc\u306e\u307f\u30a2\u30af\u30bb\u30b9\u53ef\u80fd\n\n# \u8aad\u307f\u53d6\u308a\u5c02\u7528\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\nreadonly_dir = Path('readonly_data')\nreadonly_dir.mkdir(exist_ok=True)\nreadonly_dir.chmod(stat.S_IRUSR | stat.S_IXUSR)  # \u4f5c\u6210\u5f8c\u306b\u6a29\u9650\u5909\u66f4\n<\/code><\/pre>\n<h2>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u524a\u9664<\/h2>\n<h3>rmdir() &#8211; \u7a7a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u524a\u9664<\/h3>\n<pre><code class=\"language-python\">from pathlib import Path\n\n# \u7a7a\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u524a\u9664\nempty_dir = Path('empty_folder')\nif empty_dir.exists() and empty_dir.is_dir():\n    empty_dir.rmdir()\n<\/code><\/pre>\n<h3>shutil.rmtree() &#8211; \u4e2d\u8eab\u306e\u3042\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u524a\u9664<\/h3>\n<pre><code class=\"language-python\">from pathlib import Path\nimport shutil\n\n# \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3068\u305d\u306e\u4e2d\u8eab\u3092\u3059\u3079\u3066\u524a\u9664\ntarget_dir = Path('delete_me')\nif target_dir.exists() and target_dir.is_dir():\n    shutil.rmtree(target_dir)\n<\/code><\/pre>\n<h2>\u5b9f\u7528\u7684\u306a\u4f7f\u7528\u4f8b<\/h2>\n<h3>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u69cb\u9020\u306e\u81ea\u52d5\u4f5c\u6210<\/h3>\n<pre><code class=\"language-python\">from pathlib import Path\n\ndef create_project_structure(project_name):\n    \"\"\"\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u57fa\u672c\u69cb\u9020\u3092\u4f5c\u6210\"\"\"\n    base_dir = Path(project_name)\n    \n    # \u5fc5\u8981\u306a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u5b9a\u7fa9\n    directories = [\n        'src',\n        'tests',\n        'docs',\n        'data\/raw',\n        'data\/processed',\n        'config',\n        'logs',\n        'output'\n    ]\n    \n    # \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\n    for dir_name in directories:\n        dir_path = base_dir \/ dir_name\n        dir_path.mkdir(parents=True, exist_ok=True)\n        print(f'\u4f5c\u6210: {dir_path}')\n    \n    # \u521d\u671f\u30d5\u30a1\u30a4\u30eb\u3082\u4f5c\u6210\n    (base_dir \/ 'README.md').touch()\n    (base_dir \/ 'requirements.txt').touch()\n    (base_dir \/ '.gitignore').touch()\n    \n    print(f'\u30d7\u30ed\u30b8\u30a7\u30af\u30c8 \"{project_name}\" \u306e\u69cb\u9020\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f')\n\n# \u4f7f\u7528\u4f8b\ncreate_project_structure('my_data_project')\n<\/code><\/pre>\n<h3>\u65e5\u4ed8\u5225\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4f5c\u6210<\/h3>\n<pre><code class=\"language-python\">from pathlib import Path\nfrom datetime import datetime\n\ndef create_daily_backup_dir(base_path='backups'):\n    \"\"\"\u65e5\u4ed8\u5225\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\"\"\"\n    today = datetime.now().strftime('%Y\/%m\/%d')\n    backup_dir = Path(base_path) \/ today\n    backup_dir.mkdir(parents=True, exist_ok=True)\n    return backup_dir\n\ndef create_log_directory():\n    \"\"\"\u30ed\u30b0\u7528\u306e\u5e74\u6708\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\"\"\"\n    now = datetime.now()\n    log_dir = Path('logs') \/ str(now.year) \/ f'{now.month:02d}'\n    log_dir.mkdir(parents=True, exist_ok=True)\n    return log_dir\n\n# \u4f7f\u7528\u4f8b\nbackup_dir = create_daily_backup_dir()\nprint(f'\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u30c7\u30a3\u30ec\u30af\u30c8\u30ea: {backup_dir}')\n\nlog_dir = create_log_directory()\nprint(f'\u30ed\u30b0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea: {log_dir}')\n<\/code><\/pre>\n<h3>\u4e00\u6642\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u7ba1\u7406<\/h3>\n<pre><code class=\"language-python\">from pathlib import Path\nimport tempfile\nimport shutil\nfrom contextlib import contextmanager\n\n@contextmanager\ndef temporary_directory(base_path=None):\n    \"\"\"\u4e00\u6642\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\"\"\"\n    if base_path:\n        temp_dir = Path(base_path) \/ 'temp'\n        temp_dir.mkdir(parents=True, exist_ok=True)\n    else:\n        temp_dir = Path(tempfile.mkdtemp())\n    \n    try:\n        yield temp_dir\n    finally:\n        if temp_dir.exists():\n            shutil.rmtree(temp_dir)\n\n# \u4f7f\u7528\u4f8b\nwith temporary_directory() as temp_dir:\n    # \u4e00\u6642\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u3067\u306e\u4f5c\u696d\n    work_file = temp_dir \/ 'work.txt'\n    work_file.write_text('\u4e00\u6642\u7684\u306a\u30c7\u30fc\u30bf')\n    print(f'\u4e00\u6642\u30d5\u30a1\u30a4\u30eb: {work_file}')\n# \u3053\u3053\u3067\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u81ea\u52d5\u7684\u306b\u524a\u9664\u3055\u308c\u308b\n<\/code><\/pre>\n<h2>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u79fb\u52d5\u30fb\u540d\u524d\u5909\u66f4<\/h2>\n<h3>rename() &#8211; \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d\u306e\u5909\u66f4<\/h3>\n<pre><code class=\"language-python\">from pathlib import Path\n\n# \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d\u3092\u5909\u66f4\nold_name = Path('old_folder_name')\nnew_name = Path('new_folder_name')\n\nif old_name.exists():\n    old_name.rename(new_name)\n    print(f'{old_name} \u3092 {new_name} \u306b\u5909\u66f4\u3057\u307e\u3057\u305f')\n<\/code><\/pre>\n<h3>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u79fb\u52d5<\/h3>\n<pre><code class=\"language-python\">from pathlib import Path\nimport shutil\n\ndef move_directory(source, destination):\n    \"\"\"\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u79fb\u52d5\"\"\"\n    source_path = Path(source)\n    dest_path = Path(destination)\n    \n    if not source_path.exists():\n        print(f'\u79fb\u52d5\u5143\u304c\u5b58\u5728\u3057\u307e\u305b\u3093: {source_path}')\n        return False\n    \n    # \u79fb\u52d5\u5148\u306e\u89aa\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\n    dest_path.parent.mkdir(parents=True, exist_ok=True)\n    \n    # \u79fb\u52d5\u5b9f\u884c\n    shutil.move(str(source_path), str(dest_path))\n    print(f'{source_path} \u3092 {dest_path} \u306b\u79fb\u52d5\u3057\u307e\u3057\u305f')\n    return True\n\n# \u4f7f\u7528\u4f8b\nmove_directory('temp_data', 'archive\/2024\/temp_data')\n<\/code><\/pre>\n<h2>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u60c5\u5831\u53d6\u5f97<\/h2>\n<h3>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30b5\u30a4\u30ba\u8a08\u7b97<\/h3>\n<pre><code class=\"language-python\">from pathlib import Path\n\ndef get_directory_size(dir_path):\n    \"\"\"\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30b5\u30a4\u30ba\u3092\u8a08\u7b97\"\"\"\n    path = Path(dir_path)\n    \n    if not path.is_dir():\n        return 0\n    \n    total_size = 0\n    for file_path in path.rglob('*'):\n        if file_path.is_file():\n            try:\n                total_size += file_path.stat().st_size\n            except (PermissionError, FileNotFoundError):\n                continue\n    \n    return total_size\n\ndef format_size(size_bytes):\n    \"\"\"\u30d0\u30a4\u30c8\u30b5\u30a4\u30ba\u3092\u8aad\u307f\u3084\u3059\u3044\u5f62\u5f0f\u306b\u5909\u63db\"\"\"\n    if size_bytes &lt; 1024:\n        return f'{size_bytes} B'\n    elif size_bytes &lt; 1024**2:\n        return f'{size_bytes\/1024:.1f} KB'\n    elif size_bytes &lt; 1024**3:\n        return f'{size_bytes\/1024**2:.1f} MB'\n    else:\n        return f'{size_bytes\/1024**3:.1f} GB'\n\n# \u4f7f\u7528\u4f8b\nsize = get_directory_size('.')\nprint(f'\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30b5\u30a4\u30ba: {format_size(size)}')\n<\/code><\/pre>\n<h3>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u9020\u306e\u8868\u793a<\/h3>\n<pre><code class=\"language-python\">from pathlib import Path\n\ndef show_directory_tree(dir_path, max_depth=3, current_depth=0):\n    \"\"\"\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u9020\u3092\u30c4\u30ea\u30fc\u5f62\u5f0f\u3067\u8868\u793a\"\"\"\n    path = Path(dir_path)\n    \n    if not path.is_dir() or current_depth &gt;= max_depth:\n        return\n    \n    indent = '  ' * current_depth\n    print(f'{indent}{path.name}\/')\n    \n    try:\n        for item in sorted(path.iterdir()):\n            if item.is_dir():\n                show_directory_tree(item, max_depth, current_depth + 1)\n            else:\n                print(f'{indent}  {item.name}')\n    except PermissionError:\n        print(f'{indent}  [\u30a2\u30af\u30bb\u30b9\u6a29\u9650\u306a\u3057]')\n\n# \u4f7f\u7528\u4f8b\nshow_directory_tree('.', max_depth=2)\n<\/code><\/pre>\n<h2>\u5b89\u5168\u306a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u64cd\u4f5c<\/h2>\n<h3>\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u4ed8\u304d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4f5c\u6210<\/h3>\n<pre><code class=\"language-python\">from pathlib import Path\nimport os\n\ndef safe_mkdir(dir_path, parents=True, exist_ok=True):\n    \"\"\"\u5b89\u5168\u306a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4f5c\u6210\"\"\"\n    path = Path(dir_path)\n    \n    try:\n        path.mkdir(parents=parents, exist_ok=exist_ok)\n        print(f'\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f: {path}')\n        return True\n    except PermissionError:\n        print(f'\u6a29\u9650\u30a8\u30e9\u30fc: {path} \u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093')\n    except FileExistsError:\n        print(f'\u65e2\u306b\u5b58\u5728\u3057\u307e\u3059: {path}')\n    except OSError as e:\n        print(f'OS \u30a8\u30e9\u30fc: {e}')\n    \n    return False\n\ndef safe_rmdir(dir_path, force=False):\n    \"\"\"\u5b89\u5168\u306a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u524a\u9664\"\"\"\n    path = Path(dir_path)\n    \n    if not path.exists():\n        print(f'\u524a\u9664\u5bfe\u8c61\u304c\u5b58\u5728\u3057\u307e\u305b\u3093: {path}')\n        return False\n    \n    if not path.is_dir():\n        print(f'\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3067\u306f\u3042\u308a\u307e\u305b\u3093: {path}')\n        return False\n    \n    try:\n        if force:\n            import shutil\n            shutil.rmtree(path)\n        else:\n            path.rmdir()  # \u7a7a\u306e\u5834\u5408\u306e\u307f\u524a\u9664\n        print(f'\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u524a\u9664\u3057\u307e\u3057\u305f: {path}')\n        return True\n    except OSError as e:\n        print(f'\u524a\u9664\u30a8\u30e9\u30fc: {e}')\n        return False\n\n# \u4f7f\u7528\u4f8b\nsafe_mkdir('new_project\/data\/input')\nsafe_rmdir('temp_folder', force=True)\n<\/code><\/pre>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>pathlib\u3092\u4f7f\u3063\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u64cd\u4f5c\u306f\u3001\u5f93\u6765\u306eos\u30e2\u30b8\u30e5\u30fc\u30eb\u3088\u308a\u3082\u76f4\u611f\u7684\u3067\u8aad\u307f\u3084\u3059\u3044\u30b3\u30fc\u30c9\u304c\u66f8\u3051\u307e\u3059\u3002\u7279\u306b<code>mkdir(parents=True, exist_ok=True)<\/code>\u306e\u7d44\u307f\u5408\u308f\u305b\u306f\u3001\u968e\u5c64\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4f5c\u6210\u3067\u975e\u5e38\u306b\u4fbf\u5229\u3067\u3059\u3002\u524a\u9664\u51e6\u7406\u3067\u306f\u9069\u5207\u306a\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3092\u884c\u3044\u3001\u4e88\u671f\u3057\u306a\u3044\u30c7\u30fc\u30bf\u640d\u5931\u3092\u9632\u3050\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u25a0\u30d7\u30ed\u30f3\u30d7\u30c8\u3060\u3051\u3067\u30aa\u30ea\u30b8\u30ca\u30eb\u30a2\u30d7\u30ea\u3092\u958b\u767a\u30fb\u516c\u958b\u3057\u3066\u307f\u305f\uff01\uff01<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"UpSY9sRolU\"><a href=\"https:\/\/techgym.jp\/column\/ori-app\/\">\u30d7\u30ed\u30f3\u30d7\u30c8\u3060\u3051\u3067\u30aa\u30ea\u30b8\u30ca\u30eb\u30a2\u30d7\u30ea\u3092\u958b\u767a\u30fb\u516c\u958b\u3057\u3066\u307f\u305f\uff01\uff01<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;\u30d7\u30ed\u30f3\u30d7\u30c8\u3060\u3051\u3067\u30aa\u30ea\u30b8\u30ca\u30eb\u30a2\u30d7\u30ea\u3092\u958b\u767a\u30fb\u516c\u958b\u3057\u3066\u307f\u305f\uff01\uff01&#8221; &#8212; \u3010\u30c6\u30c3\u30af\u30b8\u30e0\u3011\u683c\u5b89\u30fb\u5bfe\u9762\u578b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30af\u30fc\u30eb\" src=\"https:\/\/techgym.jp\/column\/ori-app\/embed\/#?secret=RRCTlgVsW5#?secret=UpSY9sRolU\" data-secret=\"UpSY9sRolU\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>\u25a0AI\u6642\u4ee3\u306e\u7b2c\u4e00\u6b69\uff01\u300cAI\u99c6\u52d5\u958b\u767a\u30b3\u30fc\u30b9\u300d\u306f\u3058\u3081\u307e\u3057\u305f\uff01<\/p>\n\n\n\n<p>\u30c6\u30c3\u30af\u30b8\u30e0\u6771\u4eac\u672c\u6821\u3067\u5148\u884c\u958b\u59cb\u3002<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"jepC5JCfEk\"><a href=\"https:\/\/techgym.jp\/about\/ai-driven-development\/\">AI\u99c6\u52d5\u958b\u767a\/\u751f\u6210AI\u30a8\u30f3\u30b8\u30cb\u30a2\u30b3\u30fc\u30b9\uff08\u521d\u5fc3\u8005\u5411\u3051\uff09<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;AI\u99c6\u52d5\u958b\u767a\/\u751f\u6210AI\u30a8\u30f3\u30b8\u30cb\u30a2\u30b3\u30fc\u30b9\uff08\u521d\u5fc3\u8005\u5411\u3051\uff09&#8221; &#8212; \u3010\u30c6\u30c3\u30af\u30b8\u30e0\u3011\u683c\u5b89\u30fb\u5bfe\u9762\u578b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30af\u30fc\u30eb\" src=\"https:\/\/techgym.jp\/about\/ai-driven-development\/embed\/#?secret=psBtYCn9RR#?secret=jepC5JCfEk\" data-secret=\"jepC5JCfEk\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>\u25a0\u30c6\u30c3\u30af\u30b8\u30e0\u6771\u4eac\u672c\u6821<\/p>\n\n\n\n<p>\u300c\u6b66\u7530\u587e\u300d\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u7248\u3068\u3044\u3048\u3070\u300c\u30c6\u30c3\u30af\u30b8\u30e0\u300d\u3002<br>\u8b1b\u7fa9\u52d5\u753b\u306a\u3057\u3001\u6559\u79d1\u66f8\u306a\u3057\u3002\u300c\u9032\u6357\u7ba1\u7406\u3068\u30b3\u30fc\u30c1\u30f3\u30b0\u300d\u3067\u52b9\u7387\u5b66\u7fd2\u3002<br>\u3088\u308a\u65e9\u304f\u3001\u3088\u308a\u5b89\u304f\u3001\u3057\u304b\u3082\u5bfe\u9762\u578b\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30af\u30fc\u30eb\u3067\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"Wubb8MTvDz\"><a href=\"https:\/\/techgym.jp\/tokyo\/tokyo_honko\/\">\u30c6\u30c3\u30af\u30b8\u30e0\u6771\u4eac\u672c\u6821<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;\u30c6\u30c3\u30af\u30b8\u30e0\u6771\u4eac\u672c\u6821&#8221; &#8212; \u3010\u30c6\u30c3\u30af\u30b8\u30e0\u3011\u683c\u5b89\u30fb\u5bfe\u9762\u578b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30af\u30fc\u30eb\" src=\"https:\/\/techgym.jp\/tokyo\/tokyo_honko\/embed\/#?secret=LSGmWvWjfM#?secret=Wubb8MTvDz\" data-secret=\"Wubb8MTvDz\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>\uff1c\u77ed\u671f\u8b1b\u7fd2\uff1e5\u65e5\u30675\u4e07\u5186\u306e\u300cPython\u30df\u30cb\u30ad\u30e3\u30f3\u30d7\u300d\u958b\u50ac\u4e2d\u3002<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"wkyLeMNIC6\"><a href=\"https:\/\/techgym.jp\/event\/nagatacho_camp\/\">\u72ec\u5b66\u3082\u30aa\u30f3\u30e9\u30a4\u30f3\u3082\u7121\u7406\u3060\u304b\u3089\u3001\u6709\u7d66\u3068\u3063\u3066\u300cPython\u30df\u30cb\u30ad\u30e3\u30f3\u30d7\u300d\u3078\u30105\u65e5\u9593\u30675\u4e07\u5186\u3011<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;\u72ec\u5b66\u3082\u30aa\u30f3\u30e9\u30a4\u30f3\u3082\u7121\u7406\u3060\u304b\u3089\u3001\u6709\u7d66\u3068\u3063\u3066\u300cPython\u30df\u30cb\u30ad\u30e3\u30f3\u30d7\u300d\u3078\u30105\u65e5\u9593\u30675\u4e07\u5186\u3011&#8221; &#8212; \u3010\u30c6\u30c3\u30af\u30b8\u30e0\u3011\u683c\u5b89\u30fb\u5bfe\u9762\u578b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30af\u30fc\u30eb\" src=\"https:\/\/techgym.jp\/event\/nagatacho_camp\/embed\/#?secret=itpkhDVWf8#?secret=wkyLeMNIC6\" data-secret=\"wkyLeMNIC6\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>\uff1c\u67081\u958b\u50ac\uff1e\u653e\u9001\u4f5c\u5bb6\u306b\u3088\u308b\u6620\u50cf\u30c7\u30a3\u30ec\u30af\u30bf\u30fc\u990a\u6210\u8b1b\u5ea7<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"UGO9jaL8um\"><a href=\"https:\/\/techgym.jp\/event\/video_director\/\">\u73fe\u5f79\u653e\u9001\u4f5c\u5bb6\u304c\u6559\u3048\u308b\u52d5\u753b\u8b1b\u5ea7\uff01\u300e\uff24\uff2f\uff27\uff21\u300f<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;\u73fe\u5f79\u653e\u9001\u4f5c\u5bb6\u304c\u6559\u3048\u308b\u52d5\u753b\u8b1b\u5ea7\uff01\u300e\uff24\uff2f\uff27\uff21\u300f&#8221; &#8212; \u3010\u30c6\u30c3\u30af\u30b8\u30e0\u3011\u683c\u5b89\u30fb\u5bfe\u9762\u578b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30af\u30fc\u30eb\" src=\"https:\/\/techgym.jp\/event\/video_director\/embed\/#?secret=wdKC2oZYid#?secret=UGO9jaL8um\" data-secret=\"UGO9jaL8um\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>\uff1c\u30aa\u30f3\u30e9\u30a4\u30f3\u7121\u6599\uff1e\u30bc\u30ed\u304b\u3089\u59cb\u3081\u308bPython\u7206\u901f\u8b1b\u5ea7<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"mnPddJgsZU\"><a href=\"https:\/\/techgym.jp\/tokyo_python\/\">\u30bc\u30ed\u304b\u3089\u59cb\u3081\u308bPython\u7206\u901f\u8b1b\u5ea7\uff08\u7406\u7cfb\u30fb\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u521d\u5fc3\u8005\u5411\u3051\uff09<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;\u30bc\u30ed\u304b\u3089\u59cb\u3081\u308bPython\u7206\u901f\u8b1b\u5ea7\uff08\u7406\u7cfb\u30fb\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u521d\u5fc3\u8005\u5411\u3051\uff09&#8221; &#8212; \u3010\u30c6\u30c3\u30af\u30b8\u30e0\u3011\u683c\u5b89\u30fb\u5bfe\u9762\u578b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30af\u30fc\u30eb\" src=\"https:\/\/techgym.jp\/tokyo_python\/embed\/#?secret=ItblClaARw#?secret=mnPddJgsZU\" data-secret=\"mnPddJgsZU\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4f5c\u6210 mkdir() &#8211; \u57fa\u672c\u7684\u306a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4f5c\u6210 from pathlib import Path # \u5358\u4e00\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4f5c\u6210 new_dir = Path(&#8216;new_folder&#8217;) n [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":42501,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-44121","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-column"],"views":101,"jetpack_featured_media_url":"\/wp-content\/uploads\/2025\/07\/f3403acf5c65aedec0dba821c4c26404.png","jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techgym.jp\/wp-json\/wp\/v2\/posts\/44121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techgym.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techgym.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techgym.jp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techgym.jp\/wp-json\/wp\/v2\/comments?post=44121"}],"version-history":[{"count":0,"href":"https:\/\/techgym.jp\/wp-json\/wp\/v2\/posts\/44121\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techgym.jp\/wp-json\/wp\/v2\/media\/42501"}],"wp:attachment":[{"href":"https:\/\/techgym.jp\/wp-json\/wp\/v2\/media?parent=44121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techgym.jp\/wp-json\/wp\/v2\/categories?post=44121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techgym.jp\/wp-json\/wp\/v2\/tags?post=44121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}