{"id":1136217,"date":"2025-01-08T21:33:32","date_gmt":"2025-01-08T13:33:32","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1136217.html"},"modified":"2025-01-08T21:33:35","modified_gmt":"2025-01-08T13:33:35","slug":"python%e5%a6%82%e4%bd%95%e6%8a%8a%e5%8f%98%e9%87%8f%e7%9a%84%e5%86%85%e5%ae%b9%e8%be%93%e5%87%ba%e5%88%b0%e6%96%87%e4%bb%b6%e5%a4%b9","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1136217.html","title":{"rendered":"python\u5982\u4f55\u628a\u53d8\u91cf\u7684\u5185\u5bb9\u8f93\u51fa\u5230\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\/25104640\/f7e7957b-cfc1-4f27-b1b3-36e9d80c2dac.webp\" alt=\"python\u5982\u4f55\u628a\u53d8\u91cf\u7684\u5185\u5bb9\u8f93\u51fa\u5230\u6587\u4ef6\u5939\" \/><\/p>\n<p><p> <strong>\u5728Python\u4e2d\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u5c06\u53d8\u91cf\u7684\u5185\u5bb9\u8f93\u51fa\u5230\u6587\u4ef6\u4e2d\u3002<\/strong> \u901a\u5e38\u4f7f\u7528\u5185\u7f6e\u7684<code>open()<\/code>\u51fd\u6570\u914d\u5408\u6587\u4ef6\u64cd\u4f5c\u6a21\u5f0f\u6765\u5b8c\u6210\u8fd9\u4e2a\u4efb\u52a1\u3002\u5e38\u89c1\u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u6253\u5f00\u6587\u4ef6\u3001\u5199\u5165\u5185\u5bb9\u3001\u5173\u95ed\u6587\u4ef6\u3002\u4e0b\u9762\u8be6\u7ec6\u4ecb\u7ecd\u5176\u4e2d\u4e00\u79cd\u5e38\u89c1\u7684\u65b9\u5f0f\u4ee5\u53ca\u5982\u4f55\u5728\u4e0d\u540c\u60c5\u5883\u4e0b\u5e94\u7528\u3002<\/p>\n<\/p>\n<p><p><strong>\u4f7f\u7528<code>open()<\/code>\u51fd\u6570\u5199\u5165\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p>Python \u63d0\u4f9b\u4e86\u4e00\u4e2a\u975e\u5e38\u7b80\u6d01\u7684\u6587\u4ef6\u64cd\u4f5cAPI\uff0c\u4f7f\u7528<code>open()<\/code>\u51fd\u6570\u53ef\u4ee5\u8f7b\u677e\u5730\u5b9e\u73b0\u6587\u4ef6\u7684\u8bfb\u5199\u64cd\u4f5c\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u6253\u5f00\u6587\u4ef6<\/strong>\uff1a\u4f7f\u7528<code>open()<\/code>\u51fd\u6570\u5e76\u6307\u5b9a\u6587\u4ef6\u8def\u5f84\u548c\u6a21\u5f0f\u3002<\/li>\n<li><strong>\u5199\u5165\u5185\u5bb9<\/strong>\uff1a\u4f7f\u7528<code>write()<\/code>\u65b9\u6cd5\u5c06\u53d8\u91cf\u7684\u5185\u5bb9\u5199\u5165\u6587\u4ef6\u3002<\/li>\n<li><strong>\u5173\u95ed\u6587\u4ef6<\/strong>\uff1a\u4f7f\u7528<code>close()<\/code>\u65b9\u6cd5\u5173\u95ed\u6587\u4ef6\uff0c\u786e\u4fdd\u8d44\u6e90\u91ca\u653e\u3002<\/li>\n<\/ol>\n<p><p>\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u6253\u5f00\u6587\u4ef6\uff08\u5982\u679c\u6587\u4ef6\u4e0d\u5b58\u5728\uff0c\u5c06\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u6587\u4ef6\uff09<\/p>\n<p>file_path = &#39;output.txt&#39;<\/p>\n<p>with open(file_path, &#39;w&#39;) as file:<\/p>\n<p>    # \u5199\u5165\u5185\u5bb9<\/p>\n<p>    file.write(&#39;\u8fd9\u662f\u4e00\u4e2a\u53d8\u91cf\u7684\u5185\u5bb9&#39;)<\/p>\n<h2><strong>\u6587\u4ef6\u81ea\u52a8\u5173\u95ed<\/strong><\/h2>\n<p>print(f&quot;\u5185\u5bb9\u5df2\u5199\u5165\u5230\u6587\u4ef6 {file_path}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e00\u3001\u6253\u5f00\u6587\u4ef6\u7684\u4e0d\u540c\u6a21\u5f0f<\/h3>\n<\/p>\n<p><p>\u5728\u4f7f\u7528<code>open()<\/code>\u51fd\u6570\u65f6\uff0c\u4f60\u9700\u8981\u6307\u5b9a\u6587\u4ef6\u7684\u6253\u5f00\u6a21\u5f0f\uff0c\u8fd9\u51b3\u5b9a\u4e86\u4f60\u80fd\u5bf9\u6587\u4ef6\u8fdb\u884c\u7684\u64cd\u4f5c\u3002\u5e38\u89c1\u7684\u6a21\u5f0f\u5305\u62ec\uff1a<\/p>\n<\/p>\n<ul>\n<li><strong><code>&#39;r&#39;<\/code><\/strong>\uff1a\u53ea\u8bfb\u6a21\u5f0f\uff08\u9ed8\u8ba4\uff09\u3002<\/li>\n<li><strong><code>&#39;w&#39;<\/code><\/strong>\uff1a\u5199\u5165\u6a21\u5f0f\uff08\u4f1a\u8986\u76d6\u6587\u4ef6\u5185\u5bb9\uff09\u3002<\/li>\n<li><strong><code>&#39;a&#39;<\/code><\/strong>\uff1a\u8ffd\u52a0\u6a21\u5f0f\uff08\u5728\u6587\u4ef6\u672b\u5c3e\u6dfb\u52a0\u5185\u5bb9\uff09\u3002<\/li>\n<li><strong><code>&#39;b&#39;<\/code><\/strong>\uff1a\u4e8c\u8fdb\u5236\u6a21\u5f0f\u3002<\/li>\n<li><strong><code>&#39;+&#39;<\/code><\/strong>\uff1a\u8bfb\u5199\u6a21\u5f0f\u3002<\/li>\n<\/ul>\n<p><p>\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u5e0c\u671b\u5c06\u53d8\u91cf\u7684\u5185\u5bb9\u8ffd\u52a0\u5230\u6587\u4ef6\u672b\u5c3e\uff0c\u53ef\u4ee5\u4f7f\u7528\u8ffd\u52a0\u6a21\u5f0f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">file_path = &#39;output.txt&#39;<\/p>\n<p>with open(file_path, &#39;a&#39;) as file:<\/p>\n<p>    file.write(&#39;\u8fd9\u662f\u8ffd\u52a0\u7684\u53d8\u91cf\u5185\u5bb9\\n&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u5199\u5165\u4e0d\u540c\u7c7b\u578b\u7684\u53d8\u91cf<\/h3>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u5199\u5165\u4e0d\u540c\u7c7b\u578b\u7684\u53d8\u91cf\u5185\u5bb9\uff0c\u5305\u62ec\u5b57\u7b26\u4e32\u3001\u6570\u5b57\u3001\u5217\u8868\u3001\u5b57\u5178\u7b49\u3002\u4e0b\u9762\u5206\u522b\u4ecb\u7ecd\u5982\u4f55\u5904\u7406\u8fd9\u4e9b\u60c5\u51b5\u3002<\/p>\n<\/p>\n<p><h4>1. \u5199\u5165\u5b57\u7b26\u4e32<\/h4>\n<\/p>\n<p><p>\u5b57\u7b26\u4e32\u662f\u6700\u5e38\u89c1\u7684\u53d8\u91cf\u7c7b\u578b\uff0c\u76f4\u63a5\u4f7f\u7528<code>write()<\/code>\u65b9\u6cd5\u5373\u53ef\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">file_path = &#39;output.txt&#39;<\/p>\n<p>string_variable = &#39;\u8fd9\u662f\u4e00\u4e2a\u5b57\u7b26\u4e32\u53d8\u91cf&#39;<\/p>\n<p>with open(file_path, &#39;w&#39;) as file:<\/p>\n<p>    file.write(string_variable)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u5199\u5165\u6570\u5b57<\/h4>\n<\/p>\n<p><p>\u6570\u5b57\u9700\u8981\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u624d\u80fd\u5199\u5165\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528<code>str()<\/code>\u51fd\u6570\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">file_path = &#39;output.txt&#39;<\/p>\n<p>number_variable = 12345<\/p>\n<p>with open(file_path, &#39;w&#39;) as file:<\/p>\n<p>    file.write(str(number_variable))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u5199\u5165\u5217\u8868<\/h4>\n<\/p>\n<p><p>\u5217\u8868\u9700\u8981\u904d\u5386\u5e76\u5c06\u6bcf\u4e2a\u5143\u7d20\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\uff0c\u53ef\u4ee5\u4f7f\u7528\u5faa\u73af\u6216\u5217\u8868\u89e3\u6790\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">file_path = &#39;output.txt&#39;<\/p>\n<p>list_variable = [1, 2, 3, 4, 5]<\/p>\n<p>with open(file_path, &#39;w&#39;) as file:<\/p>\n<p>    for item in list_variable:<\/p>\n<p>        file.write(str(item) + &#39;\\n&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4. \u5199\u5165\u5b57\u5178<\/h4>\n<\/p>\n<p><p>\u5b57\u5178\u53ef\u4ee5\u4f7f\u7528<code>json<\/code>\u6a21\u5757\u8fdb\u884c\u5e8f\u5217\u5316\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import json<\/p>\n<p>file_path = &#39;output.txt&#39;<\/p>\n<p>dict_variable = {&#39;name&#39;: &#39;Alice&#39;, &#39;age&#39;: 25}<\/p>\n<p>with open(file_path, &#39;w&#39;) as file:<\/p>\n<p>    json.dump(dict_variable, file)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u5904\u7406\u5927\u6587\u4ef6\u548c\u4e8c\u8fdb\u5236\u6570\u636e<\/h3>\n<\/p>\n<p><p>\u5728\u5904\u7406\u5927\u6587\u4ef6\u6216\u4e8c\u8fdb\u5236\u6570\u636e\u65f6\uff0c\u5efa\u8bae\u4f7f\u7528\u6d41\u5f0f\u5199\u5165\u65b9\u5f0f\u4ee5\u8282\u7701\u5185\u5b58\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">file_path = &#39;large_file.bin&#39;<\/p>\n<p>data = b&#39;\\x00\\x01\\x02\\x03\\x04\\x05&#39;<\/p>\n<p>with open(file_path, &#39;wb&#39;) as file:<\/p>\n<p>    file.write(data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u5f02\u5e38\u5904\u7406<\/h3>\n<\/p>\n<p><p>\u5728\u6587\u4ef6\u64cd\u4f5c\u4e2d\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u5404\u79cd\u5f02\u5e38\u60c5\u51b5\uff0c\u4f8b\u5982\u6587\u4ef6\u4e0d\u5b58\u5728\u3001\u6743\u9650\u4e0d\u8db3\u7b49\u3002\u53ef\u4ee5\u4f7f\u7528<code>try...except<\/code>\u8bed\u53e5\u8fdb\u884c\u5904\u7406\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">file_path = &#39;output.txt&#39;<\/p>\n<p>try:<\/p>\n<p>    with open(file_path, &#39;w&#39;) as file:<\/p>\n<p>        file.write(&#39;\u8fd9\u662f\u4e00\u4e2a\u53d8\u91cf\u7684\u5185\u5bb9&#39;)<\/p>\n<p>except IOError as e:<\/p>\n<p>    print(f&quot;\u6587\u4ef6\u64cd\u4f5c\u5931\u8d25\uff1a{e}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e94\u3001\u7efc\u5408\u793a\u4f8b<\/h3>\n<\/p>\n<p><p>\u4e0b\u9762\u662f\u4e00\u4e2a\u7efc\u5408\u793a\u4f8b\uff0c\u5c06\u4e0d\u540c\u7c7b\u578b\u7684\u53d8\u91cf\u5185\u5bb9\u5199\u5165\u540c\u4e00\u4e2a\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import json<\/p>\n<p>file_path = &#39;output.txt&#39;<\/p>\n<p>string_variable = &#39;\u8fd9\u662f\u4e00\u4e2a\u5b57\u7b26\u4e32\u53d8\u91cf&#39;<\/p>\n<p>number_variable = 12345<\/p>\n<p>list_variable = [1, 2, 3, 4, 5]<\/p>\n<p>dict_variable = {&#39;name&#39;: &#39;Alice&#39;, &#39;age&#39;: 25}<\/p>\n<p>try:<\/p>\n<p>    with open(file_path, &#39;w&#39;) as file:<\/p>\n<p>        file.write(string_variable + &#39;\\n&#39;)<\/p>\n<p>        file.write(str(number_variable) + &#39;\\n&#39;)<\/p>\n<p>        for item in list_variable:<\/p>\n<p>            file.write(str(item) + &#39;\\n&#39;)<\/p>\n<p>        json.dump(dict_variable, file)<\/p>\n<p>        file.write(&#39;\\n&#39;)<\/p>\n<p>except IOError as e:<\/p>\n<p>    print(f&quot;\u6587\u4ef6\u64cd\u4f5c\u5931\u8d25\uff1a{e}&quot;)<\/p>\n<p>print(f&quot;\u5185\u5bb9\u5df2\u5199\u5165\u5230\u6587\u4ef6 {file_path}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\u548c\u793a\u4f8b\u4ee3\u7801\uff0c\u4f60\u53ef\u4ee5\u7075\u6d3b\u5730\u5c06\u4e0d\u540c\u7c7b\u578b\u7684\u53d8\u91cf\u5185\u5bb9\u8f93\u51fa\u5230\u6587\u4ef6\u4e2d\u3002\u8fd9\u4e9b\u65b9\u6cd5\u4e0d\u4ec5\u9002\u7528\u4e8e\u7b80\u5355\u7684\u6587\u672c\u6587\u4ef6\uff0c\u8fd8\u53ef\u4ee5\u5904\u7406\u590d\u6742\u7684\u6570\u636e\u7ed3\u6784\u548c\u4e8c\u8fdb\u5236\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><p>\u5c06\u53d8\u91cf\u7684\u5185\u5bb9\u8f93\u51fa\u5230\u6587\u4ef6\u662fPython\u7f16\u7a0b\u4e2d\u5e38\u89c1\u7684\u4efb\u52a1\uff0c\u638c\u63e1\u8fd9\u4e9b\u6280\u5de7\u53ef\u4ee5\u6781\u5927\u63d0\u5347\u4f60\u7684\u6587\u4ef6\u64cd\u4f5c\u80fd\u529b\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u5c06\u53d8\u91cf\u5185\u5bb9\u5199\u5165\u6587\u4ef6\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u5185\u7f6e\u7684<code>open()<\/code>\u51fd\u6570\u6765\u521b\u5efa\u6216\u6253\u5f00\u4e00\u4e2a\u6587\u4ef6\uff0c\u5e76\u4f7f\u7528<code>write()<\/code>\u65b9\u6cd5\u5c06\u53d8\u91cf\u7684\u5185\u5bb9\u5199\u5165\u8be5\u6587\u4ef6\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff1a  <\/p>\n<pre><code class=\"language-python\">variable_content = &quot;\u8fd9\u662f\u8981\u5199\u5165\u6587\u4ef6\u7684\u5185\u5bb9&quot;\nwith open(&quot;output.txt&quot;, &quot;w&quot;) as file:\n    file.write(variable_content)\n<\/code><\/pre>\n<p>\u6b64\u4ee3\u7801\u4f1a\u5728\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>output.txt<\/code>\u7684\u6587\u4ef6\uff0c\u5e76\u5c06<code>variable_content<\/code>\u4e2d\u7684\u5185\u5bb9\u5199\u5165\u5176\u4e2d\u3002<\/p>\n<p><strong>\u53ef\u4ee5\u5c06\u53d8\u91cf\u5185\u5bb9\u8f93\u51fa\u5230\u7279\u5b9a\u7684\u6587\u4ef6\u5939\u5417\uff1f<\/strong><br \/>\u5f53\u7136\u53ef\u4ee5\u3002\u5728\u6307\u5b9a\u6587\u4ef6\u8def\u5f84\u65f6\uff0c\u53ea\u9700\u5728\u6587\u4ef6\u540d\u4e4b\u524d\u6dfb\u52a0\u6587\u4ef6\u5939\u8def\u5f84\u3002\u4f8b\u5982\uff0c\u5982\u679c\u8981\u5c06\u6587\u4ef6\u8f93\u51fa\u5230\u540d\u4e3a<code>my_folder<\/code>\u7684\u6587\u4ef6\u5939\u4e2d\uff0c\u53ef\u4ee5\u8fd9\u6837\u505a\uff1a  <\/p>\n<pre><code class=\"language-python\">folder_path = &quot;my_folder\/output.txt&quot;\nwith open(folder_path, &quot;w&quot;) as file:\n    file.write(variable_content)\n<\/code><\/pre>\n<p>\u786e\u4fdd\u76ee\u6807\u6587\u4ef6\u5939\u5df2\u5b58\u5728\uff0c\u5426\u5219\u4f1a\u5bfc\u81f4\u9519\u8bef\u3002<\/p>\n<p><strong>\u5982\u4f55\u5c06\u591a\u4e2a\u53d8\u91cf\u7684\u5185\u5bb9\u5199\u5165\u540c\u4e00\u4e2a\u6587\u4ef6\u4e2d\uff1f<\/strong><br \/>\u5982\u679c\u9700\u8981\u5c06\u591a\u4e2a\u53d8\u91cf\u7684\u5185\u5bb9\u5199\u5165\u540c\u4e00\u4e2a\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528<code>write()<\/code>\u65b9\u6cd5\u591a\u6b21\uff0c\u6216\u8005\u4f7f\u7528\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\u3002\u793a\u4f8b\u5982\u4e0b\uff1a  <\/p>\n<pre><code class=\"language-python\">var1 = &quot;\u5185\u5bb91&quot;\nvar2 = &quot;\u5185\u5bb92&quot;\nwith open(&quot;output.txt&quot;, &quot;w&quot;) as file:\n    file.write(var1 + &quot;\\n&quot;)\n    file.write(var2 + &quot;\\n&quot;)\n<\/code><\/pre>\n<p>\u8fd9\u79cd\u65b9\u5f0f\u5c06\u4e24\u4e2a\u53d8\u91cf\u7684\u5185\u5bb9\u5199\u5165\u540c\u4e00\u4e2a\u6587\u4ef6\uff0c\u5e76\u5728\u6bcf\u4e2a\u5185\u5bb9\u4e4b\u95f4\u6dfb\u52a0\u6362\u884c\u7b26\uff0c\u4f7f\u5176\u66f4\u6613\u4e8e\u9605\u8bfb\u3002<\/p>\n<p><strong>\u5982\u4f55\u786e\u4fdd\u6587\u4ef6\u5199\u5165\u64cd\u4f5c\u7684\u5b89\u5168\u6027\uff1f<\/strong><br \/>\u4e3a\u4e86\u786e\u4fdd\u6587\u4ef6\u5199\u5165\u64cd\u4f5c\u7684\u5b89\u5168\u6027\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f02\u5e38\u5904\u7406\uff08try-except\uff09\u6765\u6355\u83b7\u53ef\u80fd\u53d1\u751f\u7684\u9519\u8bef\u3002\u4f8b\u5982\uff0c\u6587\u4ef6\u5199\u5165\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u4f1a\u9047\u5230\u6743\u9650\u95ee\u9898\u6216\u78c1\u76d8\u7a7a\u95f4\u4e0d\u8db3\u7b49\u60c5\u51b5\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a  <\/p>\n<pre><code class=\"language-python\">try:\n    with open(&quot;output.txt&quot;, &quot;w&quot;) as file:\n        file.write(variable_content)\nexcept IOError as e:\n    print(f&quot;\u5199\u5165\u6587\u4ef6\u65f6\u53d1\u751f\u9519\u8bef: {e}&quot;)\n<\/code><\/pre>\n<p>\u8fd9\u79cd\u65b9\u5f0f\u80fd\u591f\u6709\u6548\u5730\u5904\u7406\u9519\u8bef\uff0c\u5e76\u786e\u4fdd\u7a0b\u5e8f\u4e0d\u4f1a\u56e0\u610f\u5916\u60c5\u51b5\u800c\u5d29\u6e83\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u5c06\u53d8\u91cf\u7684\u5185\u5bb9\u8f93\u51fa\u5230\u6587\u4ef6\u4e2d\u3002 \u901a\u5e38\u4f7f\u7528\u5185\u7f6e\u7684open()\u51fd\u6570\u914d\u5408\u6587\u4ef6\u64cd\u4f5c\u6a21\u5f0f [&hellip;]","protected":false},"author":3,"featured_media":1136224,"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\/1136217"}],"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=1136217"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1136217\/revisions"}],"predecessor-version":[{"id":1136225,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1136217\/revisions\/1136225"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1136224"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1136217"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1136217"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1136217"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}