{"id":959173,"date":"2024-12-27T03:38:24","date_gmt":"2024-12-26T19:38:24","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/959173.html"},"modified":"2024-12-27T03:38:26","modified_gmt":"2024-12-26T19:38:26","slug":"python-%e5%a6%82%e4%bd%95%e5%88%a0%e9%99%a4%e7%bc%93%e5%ad%98%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/959173.html","title":{"rendered":"python \u5982\u4f55\u5220\u9664\u7f13\u5b58\u6587\u4ef6"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25102050\/2f195ea4-6e83-46a5-a0ba-9d1ba6a30eb4.webp\" alt=\"python \u5982\u4f55\u5220\u9664\u7f13\u5b58\u6587\u4ef6\" \/><\/p>\n<p><p> <strong>\u5728Python\u4e2d\u5220\u9664\u7f13\u5b58\u6587\u4ef6\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528os\u6a21\u5757\u5220\u9664\u6587\u4ef6\u3001\u4f7f\u7528shutil\u6a21\u5757\u5220\u9664\u76ee\u5f55\u3001\u4f7f\u7528tempfile\u6a21\u5757\u7ba1\u7406\u4e34\u65f6\u6587\u4ef6\u3002\u4f7f\u7528os\u6a21\u5757\u5220\u9664\u6587\u4ef6\u662f\u6700\u76f4\u63a5\u7684\u65b9\u6cd5\u3002<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u73b0\u4ee3\u8ba1\u7b97\u4e2d\uff0c\u7f13\u5b58\u6587\u4ef6\u662f\u63d0\u9ad8\u7a0b\u5e8f\u6027\u80fd\u7684\u91cd\u8981\u5de5\u5177\u3002\u7136\u800c\uff0c\u8fd9\u4e9b\u6587\u4ef6\u4e5f\u53ef\u80fd\u5bfc\u81f4\u5b58\u50a8\u7a7a\u95f4\u7684\u6d6a\u8d39\u6216\u7a0b\u5e8f\u5f02\u5e38\u3002\u56e0\u6b64\uff0c\u5b9a\u671f\u6e05\u7406\u7f13\u5b58\u6587\u4ef6\u662f\u4e00\u4e2a\u597d\u4e60\u60ef\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5728Python\u4e2d\u5220\u9664\u7f13\u5b58\u6587\u4ef6\u7684\u65b9\u6cd5\u548c\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001OS\u6a21\u5757\u5220\u9664\u7f13\u5b58\u6587\u4ef6<\/p>\n<\/p>\n<p><p><code>os<\/code>\u6a21\u5757\u662fPython\u6807\u51c6\u5e93\u4e2d\u7684\u4e00\u90e8\u5206\uff0c\u63d0\u4f9b\u4e86\u4e00\u4e9b\u4e0e\u64cd\u4f5c\u7cfb\u7edf\u8fdb\u884c\u4ea4\u4e92\u7684\u65b9\u6cd5\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2a\u6a21\u5757\u6765\u5220\u9664\u5355\u4e2a\u7f13\u5b58\u6587\u4ef6\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u8bc6\u522b\u7f13\u5b58\u6587\u4ef6\u8def\u5f84<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u5220\u9664\u7f13\u5b58\u6587\u4ef6\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u786e\u8ba4\u6587\u4ef6\u7684\u8def\u5f84\u3002\u901a\u5e38\uff0c\u7f13\u5b58\u6587\u4ef6\u5b58\u50a8\u5728\u7279\u5b9a\u7684\u76ee\u5f55\u4e2d\uff0c\u8fd9\u53ef\u80fd\u56e0\u7a0b\u5e8f\u6216\u64cd\u4f5c\u7cfb\u7edf\u800c\u5f02\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528os.remove()\u5220\u9664\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p><code>os.remove()<\/code>\u65b9\u6cd5\u7528\u4e8e\u5220\u9664\u6307\u5b9a\u8def\u5f84\u7684\u6587\u4ef6\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import os<\/p>\n<h2><strong>\u6307\u5b9a\u7f13\u5b58\u6587\u4ef6\u7684\u8def\u5f84<\/strong><\/h2>\n<p>cache_file_path = &#39;\/path\/to\/cache\/file&#39;<\/p>\n<h2><strong>\u5220\u9664\u7f13\u5b58\u6587\u4ef6<\/strong><\/h2>\n<p>if os.path.exists(cache_file_path):<\/p>\n<p>    os.remove(cache_file_path)<\/p>\n<p>    print(f&quot;{cache_file_path} \u5df2\u5220\u9664&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(f&quot;{cache_file_path} \u4e0d\u5b58\u5728&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u6267\u884c\u5220\u9664\u64cd\u4f5c\u524d\uff0c\u6700\u597d\u4f7f\u7528<code>os.path.exists()<\/code>\u68c0\u67e5\u6587\u4ef6\u662f\u5426\u5b58\u5728\uff0c\u4ee5\u907f\u514d\u629b\u51fa\u5f02\u5e38\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001SHUTIL\u6a21\u5757\u5220\u9664\u7f13\u5b58\u76ee\u5f55<\/p>\n<\/p>\n<p><p>\u6709\u65f6\u5019\uff0c\u7f13\u5b58\u6587\u4ef6\u53ef\u80fd\u88ab\u5b58\u50a8\u5728\u7279\u5b9a\u7684\u76ee\u5f55\u4e2d\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u5220\u9664\u6574\u4e2a\u76ee\u5f55\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528shutil.rmtree()\u5220\u9664\u76ee\u5f55<\/strong><\/p>\n<\/p>\n<p><p><code>shutil.rmtree()<\/code>\u65b9\u6cd5\u53ef\u4ee5\u9012\u5f52\u5730\u5220\u9664\u76ee\u5f55\u53ca\u5176\u5185\u5bb9\u3002\u8fd9\u5bf9\u4e8e\u6e05\u7406\u5305\u542b\u591a\u4e2a\u7f13\u5b58\u6587\u4ef6\u7684\u76ee\u5f55\u7279\u522b\u6709\u7528\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import shutil<\/p>\n<h2><strong>\u6307\u5b9a\u7f13\u5b58\u76ee\u5f55\u7684\u8def\u5f84<\/strong><\/h2>\n<p>cache_dir_path = &#39;\/path\/to\/cache\/directory&#39;<\/p>\n<h2><strong>\u5220\u9664\u7f13\u5b58\u76ee\u5f55<\/strong><\/h2>\n<p>if os.path.exists(cache_dir_path):<\/p>\n<p>    shutil.rmtree(cache_dir_path)<\/p>\n<p>    print(f&quot;{cache_dir_path} \u53ca\u5176\u5185\u5bb9\u5df2\u5220\u9664&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(f&quot;{cache_dir_path} \u4e0d\u5b58\u5728&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8bf7\u6ce8\u610f\uff0c\u4f7f\u7528<code>shutil.rmtree()<\/code>\u65f6\u9700\u8981\u683c\u5916\u5c0f\u5fc3\uff0c\u56e0\u4e3a\u5b83\u4f1a\u5220\u9664\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u5185\u5bb9\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001TEMPFILE\u6a21\u5757\u7ba1\u7406\u4e34\u65f6\u6587\u4ef6<\/p>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u7f13\u5b58\u6587\u4ef6\u53ef\u80fd\u662f\u4e34\u65f6\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528<code>tempfile<\/code>\u6a21\u5757\u6765\u521b\u5efa\u548c\u7ba1\u7406\u8fd9\u4e9b\u6587\u4ef6\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4f7f\u7528tempfile.NamedTemporaryFile<\/strong><\/p>\n<\/p>\n<p><p><code>tempfile.NamedTemporaryFile()<\/code>\u53ef\u4ee5\u7528\u6765\u521b\u5efa\u4e00\u4e2a\u4e34\u65f6\u6587\u4ef6\uff0c\u5f53\u6587\u4ef6\u4e0d\u518d\u9700\u8981\u65f6\u53ef\u4ee5\u5173\u95ed\u5e76\u81ea\u52a8\u5220\u9664\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import tempfile<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u4e34\u65f6\u6587\u4ef6<\/strong><\/h2>\n<p>with tempfile.NamedTemporaryFile(delete=True) as temp_file:<\/p>\n<p>    print(f&quot;\u4e34\u65f6\u6587\u4ef6\u5df2\u521b\u5efa: {temp_file.name}&quot;)<\/p>\n<p>    # \u53ef\u4ee5\u5728\u6b64\u5904\u4f7f\u7528\u4e34\u65f6\u6587\u4ef6<\/p>\n<h2><strong>\u79bb\u5f00\u4e0a\u4e0b\u6587\u7ba1\u7406\u5668\u540e\uff0c\u4e34\u65f6\u6587\u4ef6\u4f1a\u88ab\u81ea\u52a8\u5220\u9664<\/strong><\/h2>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u624b\u52a8\u5220\u9664\u4e34\u65f6\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p>\u5982\u679c\u4e0d\u4f7f\u7528\u4e0a\u4e0b\u6587\u7ba1\u7406\u5668\uff0c\u4e5f\u53ef\u4ee5\u624b\u52a8\u5220\u9664\u4e34\u65f6\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import tempfile<\/p>\n<p>import os<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u4e34\u65f6\u6587\u4ef6<\/strong><\/h2>\n<p>temp_file = tempfile.NamedTemporaryFile(delete=False)<\/p>\n<h2><strong>\u83b7\u53d6\u4e34\u65f6\u6587\u4ef6\u7684\u8def\u5f84<\/strong><\/h2>\n<p>temp_file_path = temp_file.name<\/p>\n<h2><strong>\u5173\u95ed\u6587\u4ef6<\/strong><\/h2>\n<p>temp_file.close()<\/p>\n<h2><strong>\u624b\u52a8\u5220\u9664\u4e34\u65f6\u6587\u4ef6<\/strong><\/h2>\n<p>if os.path.exists(temp_file_path):<\/p>\n<p>    os.remove(temp_file_path)<\/p>\n<p>    print(f&quot;\u4e34\u65f6\u6587\u4ef6 {temp_file_path} \u5df2\u5220\u9664&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001PYTHON CACHE\u5de5\u5177\u548c\u5e93<\/p>\n<\/p>\n<p><p>\u9664\u4e86\u6807\u51c6\u5e93\uff0cPython\u793e\u533a\u8fd8\u63d0\u4f9b\u4e86\u4e00\u4e9b\u5de5\u5177\u548c\u5e93\u6765\u7ba1\u7406\u7f13\u5b58\u6587\u4ef6\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>CacheControl<\/strong><\/p>\n<\/p>\n<p><p><code>CacheControl<\/code>\u662f\u4e00\u4e2a\u7528\u4e8eHTTP\u5ba2\u6237\u7aef\u7684\u7f13\u5b58\u5e93\uff0c\u53ef\u4ee5\u5e2e\u52a9\u7ba1\u7406HTTP\u8bf7\u6c42\u7684\u7f13\u5b58\u3002\u5982\u679c\u4f60\u4f7f\u7528<code>requests<\/code>\u5e93\u8fdb\u884cHTTP\u8bf7\u6c42\uff0c\u53ef\u4ee5\u7ed3\u5408<code>CacheControl<\/code>\u6765\u7f13\u5b58\u54cd\u5e94\uff0c\u5e76\u5728\u9700\u8981\u65f6\u6e05\u7406\u7f13\u5b58\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install CacheControl<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><pre><code class=\"language-python\">import requests<\/p>\n<p>from cachecontrol import CacheControl<\/p>\n<p>session = requests.Session()<\/p>\n<p>cached_session = CacheControl(session)<\/p>\n<h2><strong>\u8fdb\u884c\u8bf7\u6c42\u5e76\u7f13\u5b58\u54cd\u5e94<\/strong><\/h2>\n<p>response = cached_session.get(&#39;http:\/\/example.com&#39;)<\/p>\n<h2><strong>\u6e05\u7406\u7f13\u5b58<\/strong><\/h2>\n<p>cached_session.cache.clear()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>DiskCache<\/strong><\/p>\n<\/p>\n<p><p><code>DiskCache<\/code>\u662f\u4e00\u4e2a\u7528\u4e8e\u6301\u4e45\u5316\u7f13\u5b58\u7684\u5e93\uff0c\u5177\u6709\u7b80\u5355\u7684API\u548c\u5f3a\u5927\u7684\u529f\u80fd\u3002\u5b83\u5141\u8bb8\u4f60\u8f7b\u677e\u5730\u7ba1\u7406\u78c1\u76d8\u4e0a\u7684\u7f13\u5b58\u6570\u636e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install diskcache<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><pre><code class=\"language-python\">import diskcache<\/p>\n<h2><strong>\u521b\u5efa\u7f13\u5b58\u76ee\u5f55<\/strong><\/h2>\n<p>cache = diskcache.Cache(&#39;\/path\/to\/cache\/directory&#39;)<\/p>\n<h2><strong>\u5b58\u50a8\u6570\u636e<\/strong><\/h2>\n<p>cache.set(&#39;key&#39;, &#39;value&#39;)<\/p>\n<h2><strong>\u5220\u9664\u7f13\u5b58<\/strong><\/h2>\n<p>cache.clear()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u5b9a\u671f\u6e05\u7406\u7f13\u5b58\u7b56\u7565<\/p>\n<\/p>\n<p><p>\u4e3a\u4e86\u6709\u6548\u5730\u7ba1\u7406\u7f13\u5b58\u6587\u4ef6\uff0c\u5efa\u8bae\u5236\u5b9a\u5b9a\u671f\u6e05\u7406\u7f13\u5b58\u7684\u7b56\u7565\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5efa\u8bae\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u81ea\u52a8\u5316\u6e05\u7406<\/strong><\/p>\n<\/p>\n<p><p>\u7f16\u5199\u811a\u672c\u5b9a\u671f\u6e05\u7406\u7f13\u5b58\u6587\u4ef6\uff0c\u5e76\u4f7f\u7528\u4efb\u52a1\u8c03\u5ea6\u7a0b\u5e8f\uff08\u5982cron\u6216Windows\u4efb\u52a1\u8ba1\u5212\uff09\u6765\u81ea\u52a8\u6267\u884c\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8bbe\u7f6e\u7f13\u5b58\u6587\u4ef6\u8fc7\u671f\u65f6\u95f4<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u7f13\u5b58\u5b9e\u73b0\u4e2d\uff0c\u8bbe\u7f6e\u6587\u4ef6\u7684\u8fc7\u671f\u65f6\u95f4\uff0c\u4ee5\u4fbf\u5b9a\u671f\u5220\u9664\u8fc7\u671f\u7684\u6587\u4ef6\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u76d1\u63a7\u78c1\u76d8\u4f7f\u7528<\/strong><\/p>\n<\/p>\n<p><p>\u5b9a\u671f\u76d1\u63a7\u78c1\u76d8\u4f7f\u7528\u60c5\u51b5\uff0c\u786e\u4fdd\u7f13\u5b58\u6587\u4ef6\u4e0d\u4f1a\u5360\u7528\u8fc7\u591a\u7684\u5b58\u50a8\u7a7a\u95f4\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u65b9\u6cd5\u548c\u5de5\u5177\uff0c\u4f60\u53ef\u4ee5\u6709\u6548\u5730\u7ba1\u7406\u548c\u5220\u9664Python\u7a0b\u5e8f\u4e2d\u7684\u7f13\u5b58\u6587\u4ef6\uff0c\u786e\u4fdd\u7a0b\u5e8f\u7684\u9ad8\u6548\u8fd0\u884c\u3002\u5b9a\u671f\u6e05\u7406\u7f13\u5b58\u4e0d\u4ec5\u53ef\u4ee5\u91ca\u653e\u5b58\u50a8\u7a7a\u95f4\uff0c\u8fd8\u53ef\u4ee5\u9632\u6b62\u6f5c\u5728\u7684\u7a0b\u5e8f\u9519\u8bef\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u8bc6\u522b\u548c\u5b9a\u4f4d\u7f13\u5b58\u6587\u4ef6\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u7f13\u5b58\u6587\u4ef6\u901a\u5e38\u5b58\u50a8\u5728\u7279\u5b9a\u7684\u76ee\u5f55\u4e2d\uff0c\u4f8b\u5982\u4e34\u65f6\u6587\u4ef6\u5939\u6216\u5e94\u7528\u7a0b\u5e8f\u7684\u7f13\u5b58\u76ee\u5f55\u3002\u53ef\u4ee5\u4f7f\u7528\u6807\u51c6\u5e93\u4e2d\u7684<code>os<\/code>\u6a21\u5757\u6765\u8bbf\u95ee\u8fd9\u4e9b\u76ee\u5f55\u3002\u901a\u8fc7<code>os.path<\/code>\u6a21\u5757\u53ef\u4ee5\u5224\u65ad\u6587\u4ef6\u662f\u5426\u4e3a\u7f13\u5b58\u6587\u4ef6\uff0c\u4f8b\u5982\u6839\u636e\u6587\u4ef6\u540d\u6216\u6269\u5c55\u540d\u8fdb\u884c\u7b5b\u9009\u3002<\/p>\n<p><strong>\u4f7f\u7528Python\u5220\u9664\u7f13\u5b58\u6587\u4ef6\u7684\u6700\u4f73\u5b9e\u8df5\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>\u5728\u5220\u9664\u7f13\u5b58\u6587\u4ef6\u65f6\uff0c\u5efa\u8bae\u5148\u786e\u8ba4\u6587\u4ef6\u7684\u7528\u9014\uff0c\u907f\u514d\u8bef\u5220\u91cd\u8981\u6587\u4ef6\u3002\u53ef\u4ee5\u4f7f\u7528<code>os.remove()<\/code>\u6216<code>os.rmdir()<\/code>\u6765\u5220\u9664\u6587\u4ef6\u6216\u76ee\u5f55\u3002\u6b64\u5916\uff0c\u4f7f\u7528<code>try-except<\/code>\u7ed3\u6784\u53ef\u4ee5\u5904\u7406\u53ef\u80fd\u51fa\u73b0\u7684\u6587\u4ef6\u4e0d\u5b58\u5728\u6216\u6743\u9650\u4e0d\u8db3\u7b49\u5f02\u5e38\u60c5\u51b5\uff0c\u4ece\u800c\u63d0\u9ad8\u4ee3\u7801\u7684\u5065\u58ee\u6027\u3002<\/p>\n<p><strong>\u662f\u5426\u6709\u7b2c\u4e09\u65b9\u5e93\u53ef\u4ee5\u5e2e\u52a9\u6e05\u7406\u7f13\u5b58\u6587\u4ef6\uff1f<\/strong><br \/>\u662f\u7684\uff0cPython\u4e2d\u6709\u4e00\u4e9b\u7b2c\u4e09\u65b9\u5e93\u53ef\u4ee5\u5e2e\u52a9\u7ba1\u7406\u548c\u6e05\u7406\u7f13\u5b58\u6587\u4ef6\u3002\u4f8b\u5982\uff0c<code>shutil<\/code>\u5e93\u63d0\u4f9b\u4e86\u9ad8\u7ea7\u7684\u6587\u4ef6\u64cd\u4f5c\u529f\u80fd\uff0c\u53ef\u4ee5\u8f7b\u677e\u5220\u9664\u76ee\u5f55\u53ca\u5176\u5185\u5bb9\u3002\u6b64\u5916\uff0c<code>pathlib<\/code>\u5e93\u63d0\u4f9b\u4e86\u9762\u5411\u5bf9\u8c61\u7684\u65b9\u5f0f\u6765\u5904\u7406\u6587\u4ef6\u8def\u5f84\uff0c\u914d\u5408<code>unlink()<\/code>\u65b9\u6cd5\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u5220\u9664\u7279\u5b9a\u6587\u4ef6\u3002\u4f7f\u7528\u8fd9\u4e9b\u5e93\u53ef\u4ee5\u7b80\u5316\u7f13\u5b58\u7ba1\u7406\u7684\u8fc7\u7a0b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\u5220\u9664\u7f13\u5b58\u6587\u4ef6\u7684\u65b9\u6cd5\u5305\u62ec\uff1a\u4f7f\u7528os\u6a21\u5757\u5220\u9664\u6587\u4ef6\u3001\u4f7f\u7528shutil\u6a21\u5757\u5220\u9664\u76ee\u5f55\u3001\u4f7f\u7528tempfil [&hellip;]","protected":false},"author":3,"featured_media":959181,"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\/959173"}],"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=959173"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/959173\/revisions"}],"predecessor-version":[{"id":959184,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/959173\/revisions\/959184"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/959181"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=959173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=959173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=959173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}