{"id":1139354,"date":"2025-01-08T22:09:27","date_gmt":"2025-01-08T14:09:27","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1139354.html"},"modified":"2025-01-08T22:09:30","modified_gmt":"2025-01-08T14:09:30","slug":"%e5%a6%82%e4%bd%95%e7%94%a8python%e6%96%b0%e5%bb%ba%e4%b8%80%e4%b8%aa%e6%96%87%e4%bb%b6%e5%a4%b9%e4%b8%ad","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1139354.html","title":{"rendered":"\u5982\u4f55\u7528python\u65b0\u5efa\u4e00\u4e2a\u6587\u4ef6\u5939\u4e2d"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25102701\/b768f0fb-52d9-4922-8278-f6d5c7abbf57.webp\" alt=\"\u5982\u4f55\u7528python\u65b0\u5efa\u4e00\u4e2a\u6587\u4ef6\u5939\u4e2d\" \/><\/p>\n<p><p> <strong>\u4f7f\u7528Python\u65b0\u5efa\u4e00\u4e2a\u6587\u4ef6\u5939\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528os\u6a21\u5757\u3001\u4f7f\u7528pathlib\u6a21\u5757\u3001\u4f7f\u7528shutil\u6a21\u5757<\/strong>\u3002\u5176\u4e2d\uff0c\u6700\u5e38\u7528\u548c\u7b80\u4fbf\u7684\u662f\u4f7f\u7528<code>os<\/code>\u6a21\u5757\uff0c\u56e0\u4e3a\u5b83\u51e0\u4e4e\u5728\u6240\u6709Python\u5b89\u88c5\u4e2d\u90fd\u53ef\u7528\uff0c\u5e76\u4e14\u63d0\u4f9b\u4e86\u76f4\u63a5\u800c\u6709\u6548\u7684\u6587\u4ef6\u7cfb\u7edf\u64cd\u4f5c\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528os\u6a21\u5757<\/h3>\n<\/p>\n<p><p><code>os<\/code>\u6a21\u5757\u662fPython\u6807\u51c6\u5e93\u7684\u4e00\u90e8\u5206\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e0e\u64cd\u4f5c\u7cfb\u7edf\u8fdb\u884c\u4ea4\u4e92\u7684\u591a\u79cd\u65b9\u6cd5\u3002\u8981\u5728Python\u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u6587\u4ef6\u5939\uff0c\u53ef\u4ee5\u4f7f\u7528<code>os.makedirs()<\/code>\u51fd\u6570\u3002<\/p>\n<\/p>\n<p><h4>os.makedirs()\u51fd\u6570\u7684\u4f7f\u7528\u65b9\u6cd5<\/h4>\n<\/p>\n<p><p><code>os.makedirs()<\/code>\u51fd\u6570\u53ef\u4ee5\u9012\u5f52\u5730\u521b\u5efa\u76ee\u5f55\u3002\u8fd9\u610f\u5473\u7740\u5982\u679c\u4f60\u60f3\u521b\u5efa\u4e00\u4e2a\u591a\u5c42\u6b21\u7684\u76ee\u5f55\u7ed3\u6784\uff0c\u5b83\u4f1a\u81ea\u52a8\u521b\u5efa\u6240\u6709\u5fc5\u8981\u7684\u7236\u76ee\u5f55\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import os<\/p>\n<p>def create_directory(path):<\/p>\n<p>    try:<\/p>\n<p>        os.makedirs(path)<\/p>\n<p>        print(f&quot;Directory {path} created successfully&quot;)<\/p>\n<p>    except FileExistsError:<\/p>\n<p>        print(f&quot;Directory {path} already exists&quot;)<\/p>\n<p>    except OSError as error:<\/p>\n<p>        print(f&quot;Error creating directory {path}: {error}&quot;)<\/p>\n<h2><strong>\u793a\u4f8b\uff1a\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a&quot;new_folder&quot;\u7684\u76ee\u5f55<\/strong><\/h2>\n<p>create_directory(&quot;new_folder&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4ee3\u7801\u4e2d\uff0c<code>os.makedirs()<\/code>\u4f1a\u5c1d\u8bd5\u521b\u5efa\u6307\u5b9a\u8def\u5f84\u7684\u76ee\u5f55\u3002\u5982\u679c\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\uff0c\u4f1a\u6355\u83b7<code>FileExistsError<\/code>\u5e76\u6253\u5370\u4e00\u6761\u6d88\u606f\u3002\u5982\u679c\u53d1\u751f\u5176\u4ed6\u9519\u8bef\uff0c\u4f8b\u5982\u6ca1\u6709\u6743\u9650\u521b\u5efa\u76ee\u5f55\uff0c\u5219\u4f1a\u6355\u83b7<code>OSError<\/code>\u5e76\u6253\u5370\u9519\u8bef\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528pathlib\u6a21\u5757<\/h3>\n<\/p>\n<p><p><code>pathlib<\/code>\u6a21\u5757\u662fPython 3.4\u5f15\u5165\u7684\u4e00\u4e2a\u65b0\u7684\u9762\u5411\u5bf9\u8c61\u7684\u8def\u5f84\u64cd\u4f5c\u5e93\u3002\u5b83\u63d0\u4f9b\u4e86\u66f4\u76f4\u89c2\u548c\u66f4\u4e30\u5bcc\u7684\u63a5\u53e3\u6765\u5904\u7406\u6587\u4ef6\u7cfb\u7edf\u8def\u5f84\u3002<\/p>\n<\/p>\n<p><h4>Path.mkdir()\u65b9\u6cd5\u7684\u4f7f\u7528\u65b9\u6cd5<\/h4>\n<\/p>\n<p><p><code>Path.mkdir()<\/code>\u65b9\u6cd5\u53ef\u4ee5\u521b\u5efa\u76ee\u5f55\uff0c\u5e76\u4e14\u8fd8\u53ef\u4ee5\u8bbe\u7f6e\u662f\u5426\u9012\u5f52\u521b\u5efa\u7236\u76ee\u5f55\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from pathlib import Path<\/p>\n<p>def create_directory(path):<\/p>\n<p>    try:<\/p>\n<p>        Path(path).mkdir(parents=True, exist_ok=True)<\/p>\n<p>        print(f&quot;Directory {path} created successfully&quot;)<\/p>\n<p>    except OSError as error:<\/p>\n<p>        print(f&quot;Error creating directory {path}: {error}&quot;)<\/p>\n<h2><strong>\u793a\u4f8b\uff1a\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a&quot;new_folder&quot;\u7684\u76ee\u5f55<\/strong><\/h2>\n<p>create_directory(&quot;new_folder&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><code>Path.mkdir()<\/code>\u65b9\u6cd5\u7684<code>parents<\/code>\u53c2\u6570\u5982\u679c\u8bbe\u7f6e\u4e3a<code>True<\/code>\uff0c\u5b83\u4f1a\u9012\u5f52\u521b\u5efa\u6240\u6709\u5fc5\u8981\u7684\u7236\u76ee\u5f55\u3002<code>exist_ok<\/code>\u53c2\u6570\u5982\u679c\u8bbe\u7f6e\u4e3a<code>True<\/code>\uff0c\u5219\u5728\u76ee\u5f55\u5df2\u7ecf\u5b58\u5728\u65f6\u4e0d\u4f1a\u5f15\u53d1\u5f02\u5e38\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528shutil\u6a21\u5757<\/h3>\n<\/p>\n<p><p><code>shutil<\/code>\u6a21\u5757\u4e3b\u8981\u7528\u4e8e\u9ad8\u7ea7\u6587\u4ef6\u64cd\u4f5c\uff0c\u4f46\u4e5f\u53ef\u4ee5\u7528\u6765\u521b\u5efa\u76ee\u5f55\u3002\u867d\u7136\u5b83\u4e0d\u662f\u6700\u5e38\u7528\u7684\u65b9\u6cd5\uff0c\u4f46\u5728\u67d0\u4e9b\u590d\u6742\u60c5\u51b5\u4e0b\u53ef\u80fd\u4f1a\u6709\u7528\u3002<\/p>\n<\/p>\n<p><h4>shutil\u6a21\u5757\u521b\u5efa\u76ee\u5f55\u7684\u65b9\u6cd5<\/h4>\n<\/p>\n<p><p><code>shutil<\/code>\u6a21\u5757\u4e3b\u8981\u7528\u4e8e\u590d\u5236\u6587\u4ef6\u548c\u76ee\u5f55\uff0c\u4f46\u4e5f\u63d0\u4f9b\u4e86\u4e00\u4e9b\u5176\u4ed6\u529f\u80fd\u3002\u867d\u7136\u5b83\u6ca1\u6709\u76f4\u63a5\u7684\u521b\u5efa\u76ee\u5f55\u7684\u65b9\u6cd5\uff0c\u4f46\u53ef\u4ee5\u95f4\u63a5\u5730\u4f7f\u7528\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import shutil<\/p>\n<p>import os<\/p>\n<p>def create_directory(path):<\/p>\n<p>    try:<\/p>\n<p>        if not os.path.exists(path):<\/p>\n<p>            os.makedirs(path)<\/p>\n<p>            print(f&quot;Directory {path} created successfully&quot;)<\/p>\n<p>        else:<\/p>\n<p>            print(f&quot;Directory {path} already exists&quot;)<\/p>\n<p>    except OSError as error:<\/p>\n<p>        print(f&quot;Error creating directory {path}: {error}&quot;)<\/p>\n<h2><strong>\u793a\u4f8b\uff1a\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a&quot;new_folder&quot;\u7684\u76ee\u5f55<\/strong><\/h2>\n<p>create_directory(&quot;new_folder&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c<code>shutil<\/code>\u6a21\u5757\u6ca1\u6709\u76f4\u63a5\u521b\u5efa\u76ee\u5f55\u7684\u65b9\u6cd5\uff0c\u4f46\u53ef\u4ee5\u4e0e<code>os<\/code>\u6a21\u5757\u7ed3\u5408\u4f7f\u7528\uff0c\u4ee5\u786e\u4fdd\u76ee\u5f55\u4e0d\u5b58\u5728\u65f6\u521b\u5efa\u5b83\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u9519\u8bef\u5904\u7406\u548c\u65e5\u5fd7\u8bb0\u5f55<\/h3>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u5904\u7406\u9519\u8bef\u548c\u8bb0\u5f55\u65e5\u5fd7\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002\u4e3a\u4e86\u786e\u4fdd\u4ee3\u7801\u7684\u5065\u58ee\u6027\u548c\u53ef\u7ef4\u62a4\u6027\uff0c\u6dfb\u52a0\u9002\u5f53\u7684\u9519\u8bef\u5904\u7406\u548c\u65e5\u5fd7\u8bb0\u5f55\u662f\u5fc5\u8981\u7684\u3002<\/p>\n<\/p>\n<p><h4>\u6dfb\u52a0\u9519\u8bef\u5904\u7406<\/h4>\n<\/p>\n<p><p>\u5728\u521b\u5efa\u76ee\u5f55\u7684\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u5404\u79cd\u9519\u8bef\uff0c\u4f8b\u5982\u6743\u9650\u4e0d\u8db3\u3001\u8def\u5f84\u65e0\u6548\u7b49\u3002\u5904\u7406\u8fd9\u4e9b\u9519\u8bef\u53ef\u4ee5\u4f7f\u4f60\u7684\u4ee3\u7801\u66f4\u53ef\u9760\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import os<\/p>\n<p>import logging<\/p>\n<p>def create_directory(path):<\/p>\n<p>    try:<\/p>\n<p>        os.makedirs(path, exist_ok=True)<\/p>\n<p>        logging.info(f&quot;Directory {path} created successfully&quot;)<\/p>\n<p>    except OSError as error:<\/p>\n<p>        logging.error(f&quot;Error creating directory {path}: {error}&quot;)<\/p>\n<h2><strong>\u914d\u7f6e\u65e5\u5fd7\u8bb0\u5f55<\/strong><\/h2>\n<p>logging.basicConfig(level=logging.INFO)<\/p>\n<h2><strong>\u793a\u4f8b\uff1a\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a&quot;new_folder&quot;\u7684\u76ee\u5f55<\/strong><\/h2>\n<p>create_directory(&quot;new_folder&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u4f7f\u7528<code>logging<\/code>\u6a21\u5757\u8bb0\u5f55\u4fe1\u606f\u548c\u9519\u8bef\u3002\u8fd9\u6837\u53ef\u4ee5\u65b9\u4fbf\u5730\u8ddf\u8e2a\u4ee3\u7801\u7684\u6267\u884c\u60c5\u51b5\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u6743\u9650\u8bbe\u7f6e<\/h3>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u8bbe\u7f6e\u76ee\u5f55\u7684\u6743\u9650\u3002<code>os.makedirs()<\/code>\u548c<code>Path.mkdir()<\/code>\u65b9\u6cd5\u90fd\u53ef\u4ee5\u63a5\u53d7\u4e00\u4e2a<code>mode<\/code>\u53c2\u6570\uff0c\u7528\u6765\u8bbe\u7f6e\u65b0\u76ee\u5f55\u7684\u6743\u9650\u3002<\/p>\n<\/p>\n<p><h4>\u8bbe\u7f6e\u76ee\u5f55\u6743\u9650<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import os<\/p>\n<p>def create_directory(path, mode=0o755):<\/p>\n<p>    try:<\/p>\n<p>        os.makedirs(path, mode=mode, exist_ok=True)<\/p>\n<p>        print(f&quot;Directory {path} created with mode {oct(mode)}&quot;)<\/p>\n<p>    except OSError as error:<\/p>\n<p>        print(f&quot;Error creating directory {path}: {error}&quot;)<\/p>\n<h2><strong>\u793a\u4f8b\uff1a\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a&quot;new_folder&quot;\u7684\u76ee\u5f55\uff0c\u5e76\u8bbe\u7f6e\u6743\u9650\u4e3a755<\/strong><\/h2>\n<p>create_directory(&quot;new_folder&quot;, 0o755)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u901a\u8fc7<code>mode<\/code>\u53c2\u6570\u8bbe\u7f6e\u76ee\u5f55\u7684\u6743\u9650\u4e3a755\uff0c\u8fd9\u610f\u5473\u7740\u6240\u6709\u8005\u53ef\u4ee5\u8bfb\u3001\u5199\u548c\u6267\u884c\uff0c\u7ec4\u548c\u5176\u4ed6\u4eba\u53ef\u4ee5\u8bfb\u548c\u6267\u884c\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u7528Python\u65b0\u5efa\u6587\u4ef6\u5939\u7684\u65b9\u6cd5\u4e3b\u8981\u5305\u62ec\uff1a<strong>\u4f7f\u7528os\u6a21\u5757\u3001\u4f7f\u7528pathlib\u6a21\u5757\u3001\u4f7f\u7528shutil\u6a21\u5757<\/strong>\u3002\u5176\u4e2d\uff0c<code>os<\/code>\u6a21\u5757\u662f\u6700\u5e38\u7528\u548c\u6700\u7b80\u4fbf\u7684\u65b9\u6cd5\uff0c\u800c<code>pathlib<\/code>\u6a21\u5757\u63d0\u4f9b\u4e86\u66f4\u73b0\u4ee3\u548c\u76f4\u89c2\u7684\u63a5\u53e3\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u5904\u7406\u9519\u8bef\u548c\u8bb0\u5f55\u65e5\u5fd7\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u6b65\u9aa4\u3002\u6b64\u5916\uff0c\u6839\u636e\u9700\u8981\u8bbe\u7f6e\u76ee\u5f55\u7684\u6743\u9650\u53ef\u4ee5\u4f7f\u4f60\u7684\u4ee3\u7801\u66f4\u5b89\u5168\u548c\u53ef\u63a7\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u4f60\u53ef\u4ee5\u7528Python\u9ad8\u6548\u5730\u7ba1\u7406\u6587\u4ef6\u7cfb\u7edf\uff0c\u521b\u5efa\u6240\u9700\u7684\u76ee\u5f55\u7ed3\u6784\uff0c\u5e76\u786e\u4fdd\u4ee3\u7801\u7684\u5065\u58ee\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u6587\u4ef6\u5939\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>os<\/code>\u6a21\u5757\u7684<code>mkdir()<\/code>\u6216<code>makedirs()<\/code>\u65b9\u6cd5\u6765\u521b\u5efa\u65b0\u6587\u4ef6\u5939\u3002<code>mkdir()<\/code>\u7528\u4e8e\u521b\u5efa\u5355\u4e2a\u6587\u4ef6\u5939\uff0c\u800c<code>makedirs()<\/code>\u53ef\u4ee5\u521b\u5efa\u591a\u5c42\u76ee\u5f55\u3002\u5982\u679c\u8981\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>new_folder<\/code>\u7684\u6587\u4ef6\u5939\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<pre><code class=\"language-python\">import os\nos.mkdir(&#39;new_folder&#39;)\n<\/code><\/pre>\n<p>\u82e5\u8981\u521b\u5efa\u591a\u5c42\u6587\u4ef6\u5939\uff0c\u53ef\u4ee5\u8fd9\u6837\u5199\uff1a<\/p>\n<pre><code class=\"language-python\">os.makedirs(&#39;parent_folder\/child_folder&#39;)\n<\/code><\/pre>\n<p>\u786e\u4fdd\u5728\u8fd0\u884c\u4ee3\u7801\u4e4b\u524d\uff0c\u60a8\u5177\u6709\u5728\u76ee\u6807\u76ee\u5f55\u4e2d\u521b\u5efa\u6587\u4ef6\u5939\u7684\u6743\u9650\u3002<\/p>\n<p><strong>\u521b\u5efa\u6587\u4ef6\u5939\u65f6\u9700\u8981\u6ce8\u610f\u54ea\u4e9b\u6743\u9650\u95ee\u9898\uff1f<\/strong><br \/>\u5728\u521b\u5efa\u6587\u4ef6\u5939\u65f6\uff0c\u64cd\u4f5c\u7cfb\u7edf\u4f1a\u68c0\u67e5\u60a8\u662f\u5426\u62e5\u6709\u5728\u6307\u5b9a\u4f4d\u7f6e\u521b\u5efa\u6587\u4ef6\u5939\u7684\u6743\u9650\u3002\u5982\u679c\u6ca1\u6709\u6743\u9650\uff0c\u5c06\u4f1a\u5f15\u53d1<code>PermissionError<\/code>\u3002\u5728\u5c1d\u8bd5\u521b\u5efa\u6587\u4ef6\u5939\u4e4b\u524d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>os.access()<\/code>\u65b9\u6cd5\u68c0\u67e5\u60a8\u662f\u5426\u5177\u6709\u5199\u5165\u6743\u9650\u3002\u4f8b\u5982\uff1a<\/p>\n<pre><code class=\"language-python\">import os\nif os.access(&#39;path_to_directory&#39;, os.W_OK):\n    os.mkdir(&#39;new_folder&#39;)\nelse:\n    print(&quot;\u6ca1\u6709\u6743\u9650\u5728\u8be5\u76ee\u5f55\u4e0b\u521b\u5efa\u6587\u4ef6\u5939&quot;)\n<\/code><\/pre>\n<p>\u8fd9\u6837\u53ef\u4ee5\u6709\u6548\u907f\u514d\u6743\u9650\u95ee\u9898\u5bfc\u81f4\u7684\u5f02\u5e38\u3002<\/p>\n<p><strong>\u5982\u4f55\u5904\u7406\u6587\u4ef6\u5939\u5df2\u5b58\u5728\u7684\u60c5\u51b5\uff1f<\/strong><br \/>\u5728\u521b\u5efa\u6587\u4ef6\u5939\u65f6\uff0c\u5982\u679c\u6307\u5b9a\u7684\u6587\u4ef6\u5939\u5df2\u7ecf\u5b58\u5728\uff0c\u5c06\u4f1a\u5f15\u53d1<code>FileExistsError<\/code>\u3002\u4e3a\u4e86\u907f\u514d\u8fd9\u79cd\u60c5\u51b5\uff0c\u53ef\u4ee5\u5728\u521b\u5efa\u4e4b\u524d\u68c0\u67e5\u6587\u4ef6\u5939\u662f\u5426\u5b58\u5728\uff0c\u4f7f\u7528<code>os.path.exists()<\/code>\u65b9\u6cd5\u3002\u4f8b\u5982\uff1a<\/p>\n<pre><code class=\"language-python\">if not os.path.exists(&#39;new_folder&#39;):\n    os.mkdir(&#39;new_folder&#39;)\nelse:\n    print(&quot;\u6587\u4ef6\u5939\u5df2\u5b58\u5728&quot;)\n<\/code><\/pre>\n<p>\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u786e\u4fdd\u53ea\u5728\u6587\u4ef6\u5939\u4e0d\u5b58\u5728\u65f6\u624d\u8fdb\u884c\u521b\u5efa\uff0c\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u9519\u8bef\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u4f7f\u7528Python\u65b0\u5efa\u4e00\u4e2a\u6587\u4ef6\u5939\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528os\u6a21\u5757\u3001\u4f7f\u7528pathlib\u6a21\u5757\u3001\u4f7f\u7528shutil\u6a21\u5757\u3002\u5176\u4e2d\uff0c\u6700 [&hellip;]","protected":false},"author":3,"featured_media":1139365,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1139354"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1139354"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1139354\/revisions"}],"predecessor-version":[{"id":1139370,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1139354\/revisions\/1139370"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1139365"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1139354"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1139354"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1139354"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}