{"id":1079750,"date":"2025-01-08T12:23:48","date_gmt":"2025-01-08T04:23:48","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1079750.html"},"modified":"2025-01-08T12:23:50","modified_gmt":"2025-01-08T04:23:50","slug":"python%e6%96%87%e4%bb%b6%e5%a6%82%e4%bd%95%e8%bf%90%e8%a1%8c%e6%96%87%e4%bb%b6%e5%a4%b9-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1079750.html","title":{"rendered":"python\u6587\u4ef6\u5982\u4f55\u8fd0\u884c\u6587\u4ef6\u5939"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24182632\/00776788-47a4-4e2b-be8d-e12dc76a6c31.webp\" alt=\"python\u6587\u4ef6\u5982\u4f55\u8fd0\u884c\u6587\u4ef6\u5939\" \/><\/p>\n<p><p> <strong>Python\u6587\u4ef6\u5982\u4f55\u8fd0\u884c\u6587\u4ef6\u5939<\/strong><\/p>\n<\/p>\n<p><p><strong>Python\u6587\u4ef6\u8fd0\u884c\u6587\u4ef6\u5939\u7684\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528os\u6a21\u5757\u904d\u5386\u6587\u4ef6\u3001\u4f7f\u7528subprocess\u6a21\u5757\u6267\u884c\u6587\u4ef6\u3001\u4f7f\u7528importlib\u6a21\u5757\u52a8\u6001\u5bfc\u5165\u6587\u4ef6\u3002<\/strong> \u901a\u8fc7\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u6211\u4eec\u53ef\u4ee5\u5b9e\u73b0\u5bf9\u6587\u4ef6\u5939\u4e2d\u7684Python\u6587\u4ef6\u8fdb\u884c\u6279\u91cf\u5904\u7406\u6216\u52a8\u6001\u6267\u884c\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5176\u4e2d\u4e00\u79cd\u65b9\u6cd5\uff0c\u5373\u4f7f\u7528os\u6a21\u5757\u904d\u5386\u6587\u4ef6\u6765\u8fd0\u884c\u6587\u4ef6\u5939\u4e2d\u7684Python\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c<strong>os\u6a21\u5757<\/strong>\u63d0\u4f9b\u4e86\u64cd\u4f5c\u7cfb\u7edf\u76f8\u5173\u7684\u529f\u80fd\uff0c\u5176\u4e2d\u5305\u62ec\u904d\u5386\u76ee\u5f55\u3001\u6587\u4ef6\u64cd\u4f5c\u7b49\u3002\u901a\u8fc7os\u6a21\u5757\uff0c\u6211\u4eec\u53ef\u4ee5\u8f7b\u677e\u5730\u904d\u5386\u4e00\u4e2a\u6587\u4ef6\u5939\u4e2d\u7684\u6240\u6709\u6587\u4ef6\uff0c\u5e76\u5bf9\u5176\u4e2d\u7684Python\u6587\u4ef6\u8fdb\u884c\u5904\u7406\u3002\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5bfc\u5165os\u6a21\u5757\uff0c\u5e76\u4f7f\u7528os.walk()\u51fd\u6570\u904d\u5386\u6307\u5b9a\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u7136\u540e\uff0c\u901a\u8fc7os.path.splitext()\u51fd\u6570\u83b7\u53d6\u6587\u4ef6\u6269\u5c55\u540d\uff0c\u7b5b\u9009\u51faPython\u6587\u4ef6\uff0c\u5e76\u4f7f\u7528exec()\u51fd\u6570\u6267\u884c\u8fd9\u4e9b\u6587\u4ef6\u7684\u5185\u5bb9\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u5bfc\u5165\u5fc5\u8981\u7684\u6a21\u5757<\/h3>\n<\/p>\n<p><p>\u5728\u5f00\u59cb\u7f16\u5199\u4ee3\u7801\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5bfc\u5165os\u6a21\u5757\u3002os\u6a21\u5757\u63d0\u4f9b\u4e86\u8bb8\u591a\u4e0e\u64cd\u4f5c\u7cfb\u7edf\u76f8\u5173\u7684\u529f\u80fd\uff0c\u4f7f\u6211\u4eec\u80fd\u591f\u8f7b\u677e\u5730\u8fdb\u884c\u6587\u4ef6\u548c\u76ee\u5f55\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import os<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u5b9a\u4e49\u904d\u5386\u6587\u4ef6\u5939\u5e76\u6267\u884cPython\u6587\u4ef6\u7684\u51fd\u6570<\/h3>\n<\/p>\n<p><p>\u6211\u4eec\u53ef\u4ee5\u5b9a\u4e49\u4e00\u4e2a\u51fd\u6570\uff0c\u8be5\u51fd\u6570\u63a5\u6536\u4e00\u4e2a\u76ee\u5f55\u8def\u5f84\u4f5c\u4e3a\u53c2\u6570\uff0c\u5e76\u904d\u5386\u8be5\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3002\u5982\u679c\u6587\u4ef6\u662fPython\u6587\u4ef6\uff08\u5373\u6269\u5c55\u540d\u4e3a.py\uff09\uff0c\u5219\u6267\u884c\u8be5\u6587\u4ef6\u7684\u5185\u5bb9\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def run_python_files_in_folder(folder_path):<\/p>\n<p>    for root, dirs, files in os.walk(folder_path):<\/p>\n<p>        for file in files:<\/p>\n<p>            if file.endswith(&quot;.py&quot;):<\/p>\n<p>                file_path = os.path.join(root, file)<\/p>\n<p>                with open(file_path, &quot;r&quot;) as f:<\/p>\n<p>                    code = f.read()<\/p>\n<p>                    exec(code)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u8c03\u7528\u51fd\u6570\u5e76\u6307\u5b9a\u76ee\u5f55\u8def\u5f84<\/h3>\n<\/p>\n<p><p>\u6700\u540e\uff0c\u6211\u4eec\u9700\u8981\u8c03\u7528\u521a\u521a\u5b9a\u4e49\u7684\u51fd\u6570\uff0c\u5e76\u6307\u5b9a\u4e00\u4e2a\u76ee\u5f55\u8def\u5f84\u3002\u8be5\u76ee\u5f55\u5e94\u8be5\u5305\u542b\u6211\u4eec\u5e0c\u671b\u6267\u884c\u7684Python\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">if __name__ == &quot;__m<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>n__&quot;:<\/p>\n<p>    folder_path = &quot;path\/to\/your\/folder&quot;<\/p>\n<p>    run_python_files_in_folder(folder_path)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u8be6\u7ec6\u8bf4\u660e<\/h3>\n<\/p>\n<ol>\n<li><strong>\u5bfc\u5165\u6a21\u5757<\/strong>\uff1a\u5bfc\u5165os\u6a21\u5757\u662f\u4e3a\u4e86\u4f7f\u7528\u5176\u63d0\u4f9b\u7684\u6587\u4ef6\u548c\u76ee\u5f55\u64cd\u4f5c\u529f\u80fd\u3002<\/li>\n<li><strong>\u5b9a\u4e49\u51fd\u6570<\/strong>\uff1a\u5b9a\u4e49\u4e86\u4e00\u4e2a\u540d\u4e3arun_python_files_in_folder\u7684\u51fd\u6570\uff0c\u8be5\u51fd\u6570\u63a5\u6536\u4e00\u4e2a\u76ee\u5f55\u8def\u5f84\u4f5c\u4e3a\u53c2\u6570\u3002\u51fd\u6570\u5185\u90e8\u4f7f\u7528os.walk()\u51fd\u6570\u904d\u5386\u6307\u5b9a\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u548c\u5b50\u76ee\u5f55\u3002<\/li>\n<li><strong>\u904d\u5386\u6587\u4ef6<\/strong>\uff1a\u5728\u904d\u5386\u8fc7\u7a0b\u4e2d\uff0c\u5982\u679c\u6587\u4ef6\u662fPython\u6587\u4ef6\uff08\u5373\u6269\u5c55\u540d\u4e3a.py\uff09\uff0c\u5219\u4f7f\u7528open()\u51fd\u6570\u6253\u5f00\u6587\u4ef6\uff0c\u5e76\u8bfb\u53d6\u6587\u4ef6\u5185\u5bb9\u3002\u7136\u540e\u4f7f\u7528exec()\u51fd\u6570\u6267\u884c\u8bfb\u53d6\u5230\u7684\u4ee3\u7801\u3002<\/li>\n<li><strong>\u8c03\u7528\u51fd\u6570<\/strong>\uff1a\u5728\u811a\u672c\u7684\u4e3b\u7a0b\u5e8f\u4e2d\uff0c\u8c03\u7528run_python_files_in_folder\u51fd\u6570\uff0c\u5e76\u4f20\u5165\u4e00\u4e2a\u76ee\u5f55\u8def\u5f84\u3002\u8be5\u76ee\u5f55\u5e94\u8be5\u5305\u542b\u6211\u4eec\u5e0c\u671b\u6267\u884c\u7684Python\u6587\u4ef6\u3002<\/li>\n<\/ol>\n<p><h3>\u4e94\u3001\u4f7f\u7528subprocess\u6a21\u5757\u6267\u884c\u6587\u4ef6<\/h3>\n<\/p>\n<p><p>\u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\u4f7f\u7528subprocess\u6a21\u5757\u6267\u884c\u6587\u4ef6\u5939\u4e2d\u7684Python\u6587\u4ef6\u3002subprocess\u6a21\u5757\u5141\u8bb8\u6211\u4eec\u751f\u6210\u65b0\u7684\u8fdb\u7a0b\uff0c\u5e76\u4e0e\u8fd9\u4e9b\u8fdb\u7a0b\u8fdb\u884c\u4ea4\u4e92\u3002\u901a\u8fc7subprocess\u6a21\u5757\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u5b50\u8fdb\u7a0b\u6267\u884cPython\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import os<\/p>\n<p>import subprocess<\/p>\n<p>def run_python_files_in_folder(folder_path):<\/p>\n<p>    for root, dirs, files in os.walk(folder_path):<\/p>\n<p>        for file in files:<\/p>\n<p>            if file.endswith(&quot;.py&quot;):<\/p>\n<p>                file_path = os.path.join(root, file)<\/p>\n<p>                subprocess.run([&quot;python&quot;, file_path])<\/p>\n<p>if __name__ == &quot;__main__&quot;:<\/p>\n<p>    folder_path = &quot;path\/to\/your\/folder&quot;<\/p>\n<p>    run_python_files_in_folder(folder_path)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u8ff0\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528subprocess.run()\u51fd\u6570\u6267\u884c\u6bcf\u4e2aPython\u6587\u4ef6\u3002\u4e0eexec()\u51fd\u6570\u4e0d\u540c\uff0csubprocess.run()\u51fd\u6570\u4f1a\u751f\u6210\u4e00\u4e2a\u65b0\u7684\u5b50\u8fdb\u7a0b\u6765\u6267\u884cPython\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u4f7f\u7528importlib\u6a21\u5757\u52a8\u6001\u5bfc\u5165\u6587\u4ef6<\/h3>\n<\/p>\n<p><p>\u6211\u4eec\u8fd8\u53ef\u4ee5\u4f7f\u7528importlib\u6a21\u5757\u52a8\u6001\u5bfc\u5165\u5e76\u6267\u884c\u6587\u4ef6\u5939\u4e2d\u7684Python\u6587\u4ef6\u3002importlib\u6a21\u5757\u63d0\u4f9b\u4e86\u52a8\u6001\u5bfc\u5165\u6a21\u5757\u7684\u529f\u80fd\uff0c\u4f7f\u6211\u4eec\u80fd\u591f\u5728\u8fd0\u884c\u65f6\u5bfc\u5165\u548c\u6267\u884cPython\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import os<\/p>\n<p>import importlib.util<\/p>\n<p>def run_python_files_in_folder(folder_path):<\/p>\n<p>    for root, dirs, files in os.walk(folder_path):<\/p>\n<p>        for file in files:<\/p>\n<p>            if file.endswith(&quot;.py&quot;):<\/p>\n<p>                file_path = os.path.join(root, file)<\/p>\n<p>                spec = importlib.util.spec_from_file_location(&quot;module.name&quot;, file_path)<\/p>\n<p>                module = importlib.util.module_from_spec(spec)<\/p>\n<p>                spec.loader.exec_module(module)<\/p>\n<p>if __name__ == &quot;__main__&quot;:<\/p>\n<p>    folder_path = &quot;path\/to\/your\/folder&quot;<\/p>\n<p>    run_python_files_in_folder(folder_path)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u8ff0\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528importlib.util.spec_from_file_location()\u51fd\u6570\u521b\u5efa\u6a21\u5757\u89c4\u8303\uff0c\u5e76\u4f7f\u7528importlib.util.module_from_spec()\u51fd\u6570\u521b\u5efa\u6a21\u5757\u5bf9\u8c61\u3002\u7136\u540e\u4f7f\u7528spec.loader.exec_module()\u51fd\u6570\u6267\u884c\u6a21\u5757\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p><strong>Python\u6587\u4ef6\u8fd0\u884c\u6587\u4ef6\u5939\u7684\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528os\u6a21\u5757\u904d\u5386\u6587\u4ef6\u3001\u4f7f\u7528subprocess\u6a21\u5757\u6267\u884c\u6587\u4ef6\u3001\u4f7f\u7528importlib\u6a21\u5757\u52a8\u6001\u5bfc\u5165\u6587\u4ef6<\/strong>\u3002\u901a\u8fc7\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u6211\u4eec\u53ef\u4ee5\u5b9e\u73b0\u5bf9\u6587\u4ef6\u5939\u4e2d\u7684Python\u6587\u4ef6\u8fdb\u884c\u6279\u91cf\u5904\u7406\u6216\u52a8\u6001\u6267\u884c\u3002\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u53d6\u51b3\u4e8e\u5177\u4f53\u9700\u6c42\u548c\u4f7f\u7528\u573a\u666f\uff1a<\/p>\n<\/p>\n<ul>\n<li><strong>os\u6a21\u5757<\/strong>\uff1a\u9002\u7528\u4e8e\u9700\u8981\u904d\u5386\u76ee\u5f55\u5e76\u6267\u884c\u6587\u4ef6\u5185\u5bb9\u7684\u60c5\u51b5\u3002\u4f7f\u7528exec()\u51fd\u6570\u6267\u884c\u4ee3\u7801\uff0c\u8fd9\u79cd\u65b9\u6cd5\u8f83\u4e3a\u7b80\u5355\u76f4\u63a5\u3002<\/li>\n<li><strong>subprocess\u6a21\u5757<\/strong>\uff1a\u9002\u7528\u4e8e\u9700\u8981\u751f\u6210\u5b50\u8fdb\u7a0b\u6267\u884c\u6587\u4ef6\u7684\u60c5\u51b5\u3002\u4f7f\u7528subprocess.run()\u51fd\u6570\u751f\u6210\u5b50\u8fdb\u7a0b\u6267\u884cPython\u6587\u4ef6\u3002<\/li>\n<li><strong>importlib\u6a21\u5757<\/strong>\uff1a\u9002\u7528\u4e8e\u9700\u8981\u52a8\u6001\u5bfc\u5165\u548c\u6267\u884c\u6a21\u5757\u7684\u60c5\u51b5\u3002\u4f7f\u7528importlib.util.spec_from_file_location()\u548cimportlib.util.module_from_spec()\u51fd\u6570\u521b\u5efa\u6a21\u5757\u5bf9\u8c61\uff0c\u5e76\u6267\u884c\u6a21\u5757\u3002<\/li>\n<\/ul>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u4ecb\u7ecd\uff0c\u76f8\u4fe1\u5927\u5bb6\u5df2\u7ecf\u638c\u63e1\u4e86Python\u6587\u4ef6\u8fd0\u884c\u6587\u4ef6\u5939\u7684\u591a\u79cd\u65b9\u6cd5\u3002\u5e0c\u671b\u8fd9\u4e9b\u65b9\u6cd5\u80fd\u5e2e\u52a9\u5927\u5bb6\u66f4\u597d\u5730\u5904\u7406\u548c\u6267\u884c\u6587\u4ef6\u5939\u4e2d\u7684Python\u6587\u4ef6\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u8fd0\u884c\u4e00\u4e2a\u6587\u4ef6\u5939\u5185\u7684\u6240\u6709Python\u6587\u4ef6\uff1f<\/strong><br \/>\u8981\u5728Python\u4e2d\u8fd0\u884c\u4e00\u4e2a\u6587\u4ef6\u5939\u5185\u7684\u6240\u6709Python\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528<code>os<\/code>\u6a21\u5757\u6765\u904d\u5386\u6587\u4ef6\u5939\u4e2d\u7684\u6587\u4ef6\uff0c\u5e76\u901a\u8fc7<code>subprocess<\/code>\u6a21\u5757\u6765\u6267\u884c\u6bcf\u4e2aPython\u6587\u4ef6\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\u4ee3\u7801\uff1a  <\/p>\n<pre><code class=\"language-python\">import os\nimport subprocess\n\nfolder_path = &#39;path_to_your_folder&#39;  # \u66ff\u6362\u4e3a\u4f60\u7684\u6587\u4ef6\u5939\u8def\u5f84\n\nfor filename in os.listdir(folder_path):\n    if filename.endswith(&#39;.py&#39;):\n        file_path = os.path.join(folder_path, filename)\n        subprocess.run([&#39;python&#39;, file_path])\n<\/code><\/pre>\n<p>\u8fd0\u884c\u8fd9\u6bb5\u4ee3\u7801\u540e\uff0c\u6587\u4ef6\u5939\u4e2d\u6240\u6709\u4ee5<code>.py<\/code>\u7ed3\u5c3e\u7684\u6587\u4ef6\u5c06\u88ab\u4f9d\u6b21\u6267\u884c\u3002<\/p>\n<p><strong>\u5728Windows\u548cLinux\u4e0a\u8fd0\u884cPython\u6587\u4ef6\u5939\u6709\u4ec0\u4e48\u4e0d\u540c\u4e4b\u5904\uff1f<\/strong><br \/>\u5728Windows\u548cLinux\u4e0a\uff0c\u8fd0\u884cPython\u6587\u4ef6\u5939\u65f6\u4e3b\u8981\u7684\u533a\u522b\u5728\u4e8e\u6587\u4ef6\u8def\u5f84\u7684\u8868\u793a\u6cd5\u548c\u7ec8\u7aef\u547d\u4ee4\u3002\u5728Windows\u4e2d\uff0c\u8def\u5f84\u901a\u5e38\u4f7f\u7528\u53cd\u659c\u6760\uff08<code>\\<\/code>\uff09\uff0c\u800c\u5728Linux\u4e2d\u4f7f\u7528\u6b63\u659c\u6760\uff08<code>\/<\/code>\uff09\u3002\u6b64\u5916\uff0cWindows\u7528\u6237\u53ef\u4ee5\u76f4\u63a5\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u4f7f\u7528<code>python<\/code>\u547d\u4ee4\uff0c\u800cLinux\u7528\u6237\u53ef\u80fd\u9700\u8981\u4f7f\u7528<code>python3<\/code>\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u5b89\u88c5\u7684Python\u7248\u672c\u3002<\/p>\n<p><strong>\u5982\u4f55\u5904\u7406\u5728\u6587\u4ef6\u5939\u4e2d\u8fd0\u884cPython\u65f6\u51fa\u73b0\u7684\u9519\u8bef\uff1f<\/strong><br \/>\u5728\u8fd0\u884c\u6587\u4ef6\u5939\u4e2d\u7684Python\u6587\u4ef6\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u5404\u79cd\u9519\u8bef\u3002\u4e3a\u4e86\u6709\u6548\u5904\u7406\u8fd9\u4e9b\u9519\u8bef\uff0c\u53ef\u4ee5\u5728\u6267\u884c\u547d\u4ee4\u65f6\u6dfb\u52a0\u5f02\u5e38\u5904\u7406\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528<code>try-except<\/code>\u7ed3\u6784\u6765\u6355\u83b7\u5e76\u8bb0\u5f55\u9519\u8bef\u4fe1\u606f\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u5373\u4f7f\u67d0\u4e2a\u6587\u4ef6\u8fd0\u884c\u5931\u8d25\uff0c\u5176\u4ed6\u6587\u4ef6\u4ecd\u7136\u53ef\u4ee5\u7ee7\u7eed\u6267\u884c\u3002\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a  <\/p>\n<pre><code class=\"language-python\">try:\n    subprocess.run([&#39;python&#39;, file_path], check=True)\nexcept subprocess.CalledProcessError as e:\n    print(f&quot;Error occurred while running {file_path}: {e}&quot;)\n<\/code><\/pre>\n<p>\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u53ef\u4ee5\u66f4\u597d\u5730\u7ba1\u7406\u548c\u8c03\u8bd5\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u7684\u95ee\u9898\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u6587\u4ef6\u5982\u4f55\u8fd0\u884c\u6587\u4ef6\u5939 Python\u6587\u4ef6\u8fd0\u884c\u6587\u4ef6\u5939\u7684\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528os\u6a21\u5757\u904d\u5386\u6587\u4ef6\u3001\u4f7f\u7528subproce [&hellip;]","protected":false},"author":3,"featured_media":1079756,"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\/1079750"}],"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=1079750"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1079750\/revisions"}],"predecessor-version":[{"id":1079757,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1079750\/revisions\/1079757"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1079756"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1079750"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1079750"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1079750"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}