{"id":981684,"date":"2024-12-27T07:04:43","date_gmt":"2024-12-26T23:04:43","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/981684.html"},"modified":"2024-12-27T07:04:46","modified_gmt":"2024-12-26T23:04:46","slug":"python-%e5%a6%82%e4%bd%95%e8%be%93%e5%87%ba%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/981684.html","title":{"rendered":"python \u5982\u4f55\u8f93\u51fa\u6587\u4ef6"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24210518\/af487258-fb58-4606-82bd-887aeef105fb.webp\" alt=\"python \u5982\u4f55\u8f93\u51fa\u6587\u4ef6\" \/><\/p>\n<p><p> <strong>Python\u8f93\u51fa\u6587\u4ef6\u7684\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528<code>open()<\/code>\u51fd\u6570\u3001\u6307\u5b9a\u6a21\u5f0f\uff08\u5982<code>w<\/code>\u3001<code>a<\/code>\uff09\u3001\u5229\u7528<code>write()<\/code>\u65b9\u6cd5\u3001\u4f7f\u7528\u4e0a\u4e0b\u6587\u7ba1\u7406\u5668<code>with<\/code>\u8bed\u53e5\u7b49\u3002<\/strong>\u5176\u4e2d\uff0c<code>open()<\/code>\u51fd\u6570\u7528\u4e8e\u6253\u5f00\u6587\u4ef6\u5e76\u8fd4\u56de\u6587\u4ef6\u5bf9\u8c61\uff0c<code>write()<\/code>\u65b9\u6cd5\u5c06\u5185\u5bb9\u5199\u5165\u6587\u4ef6\uff0c\u800c\u4f7f\u7528<code>with<\/code>\u8bed\u53e5\u53ef\u4ee5\u81ea\u52a8\u7ba1\u7406\u6587\u4ef6\u7684\u6253\u5f00\u548c\u5173\u95ed\uff0c\u907f\u514d\u624b\u52a8\u5173\u95ed\u6587\u4ef6\u7684\u7e41\u7410\u3002\u6b64\u5916\uff0cPython\u8fd8\u652f\u6301\u591a\u79cd\u6587\u4ef6\u683c\u5f0f\u7684\u8f93\u51fa\uff0c\u5982\u6587\u672c\u6587\u4ef6\u3001CSV\u6587\u4ef6\u3001JSON\u6587\u4ef6\u7b49\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecdPython\u8f93\u51fa\u6587\u4ef6\u7684\u591a\u79cd\u65b9\u6cd5\u53ca\u6ce8\u610f\u4e8b\u9879\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u6587\u672c\u6587\u4ef6\u8f93\u51fa<\/h3>\n<\/p>\n<p><p>\u6587\u672c\u6587\u4ef6\u662f\u6700\u5e38\u89c1\u7684\u6587\u4ef6\u683c\u5f0f\u4e4b\u4e00\uff0c\u53ef\u4ee5\u901a\u8fc7Python\u8f7b\u677e\u8fdb\u884c\u8f93\u51fa\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u4f7f\u7528<code>open()<\/code>\u51fd\u6570<\/h4>\n<\/p>\n<p><p><code>open()<\/code>\u51fd\u6570\u7528\u4e8e\u6253\u5f00\u4e00\u4e2a\u6587\u4ef6\uff0c\u5e76\u8fd4\u56de\u6587\u4ef6\u5bf9\u8c61\u3002\u5b83\u7684\u57fa\u672c\u8bed\u6cd5\u4e3a<code>open(filename, mode)<\/code>\uff0c\u5176\u4e2d<code>filename<\/code>\u662f\u6587\u4ef6\u540d\uff0c<code>mode<\/code>\u6307\u5b9a\u6253\u5f00\u6587\u4ef6\u7684\u6a21\u5f0f\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u5199\u5165\u6a21\u5f0f\uff08<code>w<\/code>\uff09<\/strong>\uff1a\u5982\u679c\u6587\u4ef6\u4e0d\u5b58\u5728\uff0c\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u6587\u4ef6\uff1b\u5982\u679c\u6587\u4ef6\u5df2\u5b58\u5728\uff0c\u4f1a\u8986\u76d6\u539f\u6709\u5185\u5bb9\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">with open(&#39;example.txt&#39;, &#39;w&#39;) as file:<\/p>\n<p>    file.write(&#39;Hello, World!&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<p><h4>2\u3001\u8ffd\u52a0\u6a21\u5f0f<\/h4>\n<\/p>\n<ul>\n<li>\n<p><strong>\u8ffd\u52a0\u6a21\u5f0f\uff08<code>a<\/code>\uff09<\/strong>\uff1a\u5728\u6587\u4ef6\u672b\u5c3e\u8ffd\u52a0\u5185\u5bb9\uff0c\u4e0d\u4f1a\u8986\u76d6\u539f\u6709\u5185\u5bb9\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">with open(&#39;example.txt&#39;, &#39;a&#39;) as file:<\/p>\n<p>    file.write(&#39;\\nAppending a new line.&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<p><h4>3\u3001\u4e0a\u4e0b\u6587\u7ba1\u7406\u5668<code>with<\/code>\u8bed\u53e5<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528<code>with<\/code>\u8bed\u53e5\u53ef\u4ee5\u81ea\u52a8\u7ba1\u7406\u6587\u4ef6\u8d44\u6e90\uff0c\u65e0\u9700\u624b\u52a8\u5173\u95ed\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">with open(&#39;example.txt&#39;, &#39;w&#39;) as file:<\/p>\n<p>    file.write(&#39;This is a context manager example.&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001CSV\u6587\u4ef6\u8f93\u51fa<\/h3>\n<\/p>\n<p><p>CSV\uff08Comma Separated Values\uff09\u662f\u4e00\u79cd\u5e38\u7528\u7684\u6570\u636e\u683c\u5f0f\uff0c\u9002\u5408\u7528\u4e8e\u5b58\u50a8\u8868\u683c\u6570\u636e\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u4f7f\u7528<code>csv<\/code>\u6a21\u5757<\/h4>\n<\/p>\n<p><p>Python\u7684<code>csv<\/code>\u6a21\u5757\u63d0\u4f9b\u4e86\u5bf9CSV\u6587\u4ef6\u7684\u8bfb\u5199\u652f\u6301\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import csv<\/p>\n<p>data = [<\/p>\n<p>    [&#39;Name&#39;, &#39;Age&#39;, &#39;City&#39;],<\/p>\n<p>    [&#39;Alice&#39;, 30, &#39;New York&#39;],<\/p>\n<p>    [&#39;Bob&#39;, 25, &#39;Los Angeles&#39;]<\/p>\n<p>]<\/p>\n<p>with open(&#39;example.csv&#39;, &#39;w&#39;, newline=&#39;&#39;) as file:<\/p>\n<p>    writer = csv.writer(file)<\/p>\n<p>    writer.writerows(data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u5b57\u5178\u5199\u5165CSV<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528\u5b57\u5178\u5c06\u6570\u636e\u5199\u5165CSV\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import csv<\/p>\n<p>data = [<\/p>\n<p>    {&#39;Name&#39;: &#39;Alice&#39;, &#39;Age&#39;: 30, &#39;City&#39;: &#39;New York&#39;},<\/p>\n<p>    {&#39;Name&#39;: &#39;Bob&#39;, &#39;Age&#39;: 25, &#39;City&#39;: &#39;Los Angeles&#39;}<\/p>\n<p>]<\/p>\n<p>with open(&#39;example.csv&#39;, &#39;w&#39;, newline=&#39;&#39;) as file:<\/p>\n<p>    fieldnames = [&#39;Name&#39;, &#39;Age&#39;, &#39;City&#39;]<\/p>\n<p>    writer = csv.DictWriter(file, fieldnames=fieldnames)<\/p>\n<p>    writer.writeheader()<\/p>\n<p>    writer.writerows(data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001JSON\u6587\u4ef6\u8f93\u51fa<\/h3>\n<\/p>\n<p><p>JSON\uff08JavaScript Object Notation\uff09\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u6570\u636e\u4ea4\u6362\u683c\u5f0f\uff0cPython\u7684<code>json<\/code>\u6a21\u5757\u63d0\u4f9b\u4e86\u5bf9JSON\u6587\u4ef6\u7684\u8bfb\u5199\u652f\u6301\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u4f7f\u7528<code>json<\/code>\u6a21\u5757<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import json<\/p>\n<p>data = {<\/p>\n<p>    &#39;name&#39;: &#39;Alice&#39;,<\/p>\n<p>    &#39;age&#39;: 30,<\/p>\n<p>    &#39;city&#39;: &#39;New York&#39;<\/p>\n<p>}<\/p>\n<p>with open(&#39;example.json&#39;, &#39;w&#39;) as file:<\/p>\n<p>    json.dump(data, file)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u683c\u5f0f\u5316\u8f93\u51fa<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>indent<\/code>\u53c2\u6570\u4f7f\u8f93\u51fa\u7684JSON\u6587\u4ef6\u66f4\u52a0\u6613\u8bfb\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import json<\/p>\n<p>data = {<\/p>\n<p>    &#39;name&#39;: &#39;Alice&#39;,<\/p>\n<p>    &#39;age&#39;: 30,<\/p>\n<p>    &#39;city&#39;: &#39;New York&#39;<\/p>\n<p>}<\/p>\n<p>with open(&#39;example.json&#39;, &#39;w&#39;) as file:<\/p>\n<p>    json.dump(data, file, indent=4)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u4e8c\u8fdb\u5236\u6587\u4ef6\u8f93\u51fa<\/h3>\n<\/p>\n<p><p>\u5bf9\u4e8e\u9700\u8981\u5b58\u50a8\u56fe\u50cf\u3001\u97f3\u9891\u7b49\u975e\u6587\u672c\u6570\u636e\u7684\u573a\u5408\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e8c\u8fdb\u5236\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u5199\u5165\u4e8c\u8fdb\u5236\u6587\u4ef6<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">with open(&#39;example.bin&#39;, &#39;wb&#39;) as file:<\/p>\n<p>    file.write(b&#39;\\x00\\x01\\x02\\x03&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u8bfb\u5199\u4e8c\u8fdb\u5236\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>rb<\/code>\u548c<code>wb<\/code>\u6a21\u5f0f\u8bfb\u5199\u4e8c\u8fdb\u5236\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u5199\u5165<\/p>\n<p>with open(&#39;example.bin&#39;, &#39;wb&#39;) as file:<\/p>\n<p>    file.write(b&#39;\\x00\\x01\\x02\\x03&#39;)<\/p>\n<h2><strong>\u8bfb\u53d6<\/strong><\/h2>\n<p>with open(&#39;example.bin&#39;, &#39;rb&#39;) as file:<\/p>\n<p>    data = file.read()<\/p>\n<p>    print(data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e94\u3001Excel\u6587\u4ef6\u8f93\u51fa<\/h3>\n<\/p>\n<p><p>\u5bf9\u4e8e\u9700\u8981\u5904\u7406\u590d\u6742\u8868\u683c\u6570\u636e\u7684\u573a\u5408\uff0c\u53ef\u4ee5\u4f7f\u7528<code>openpyxl<\/code>\u6216<code>pandas<\/code>\u7b49\u5e93\u8f93\u51faExcel\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u4f7f\u7528<code>openpyxl<\/code>\u5e93<\/h4>\n<\/p>\n<p><p><code>openpyxl<\/code>\u5e93\u5141\u8bb8\u76f4\u63a5\u64cd\u4f5cExcel\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from openpyxl import Workbook<\/p>\n<p>wb = Workbook()<\/p>\n<p>ws = wb.active<\/p>\n<p>ws[&#39;A1&#39;] = &#39;Name&#39;<\/p>\n<p>ws[&#39;B1&#39;] = &#39;Age&#39;<\/p>\n<p>ws[&#39;C1&#39;] = &#39;City&#39;<\/p>\n<p>data = [<\/p>\n<p>    (&#39;Alice&#39;, 30, &#39;New York&#39;),<\/p>\n<p>    (&#39;Bob&#39;, 25, &#39;Los Angeles&#39;)<\/p>\n<p>]<\/p>\n<p>for row in data:<\/p>\n<p>    ws.append(row)<\/p>\n<p>wb.save(&#39;example.xlsx&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u4f7f\u7528<code>pandas<\/code>\u5e93<\/h4>\n<\/p>\n<p><p><code>pandas<\/code>\u5e93\u63d0\u4f9b\u4e86\u66f4\u9ad8\u7ea7\u7684\u6570\u636e\u64cd\u4f5c\u529f\u80fd\uff0c\u9002\u5408\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<p>data = {<\/p>\n<p>    &#39;Name&#39;: [&#39;Alice&#39;, &#39;Bob&#39;],<\/p>\n<p>    &#39;Age&#39;: [30, 25],<\/p>\n<p>    &#39;City&#39;: [&#39;New York&#39;, &#39;Los Angeles&#39;]<\/p>\n<p>}<\/p>\n<p>df = pd.DataFrame(data)<\/p>\n<p>df.to_excel(&#39;example.xlsx&#39;, index=False)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u516d\u3001\u6587\u4ef6\u8f93\u51fa\u6ce8\u610f\u4e8b\u9879<\/h3>\n<\/p>\n<p><h4>1\u3001\u6587\u4ef6\u8def\u5f84<\/h4>\n<\/p>\n<p><p>\u786e\u4fdd\u6587\u4ef6\u8def\u5f84\u6b63\u786e\uff0c\u7279\u522b\u662f\u5728\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u95f4\u4f7f\u7528\u65f6\u8981\u6ce8\u610f\u8def\u5f84\u5206\u9694\u7b26\u3002<\/p>\n<\/p>\n<p><h4>2\u3001\u7f16\u7801\u95ee\u9898<\/h4>\n<\/p>\n<p><p>\u5bf9\u4e8e\u6587\u672c\u6587\u4ef6\uff0c\u6307\u5b9a\u6b63\u786e\u7684\u7f16\u7801\u53ef\u4ee5\u907f\u514d\u4e71\u7801\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">with open(&#39;example.txt&#39;, &#39;w&#39;, encoding=&#39;utf-8&#39;) as file:<\/p>\n<p>    file.write(&#39;Some text with special characters: \u00f1, \u00fc, \u00e5&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3\u3001\u5f02\u5e38\u5904\u7406<\/h4>\n<\/p>\n<p><p>\u5728\u8fdb\u884c\u6587\u4ef6\u64cd\u4f5c\u65f6\uff0c\u52a0\u5165\u5f02\u5e38\u5904\u7406\u53ef\u4ee5\u63d0\u9ad8\u7a0b\u5e8f\u7684\u5065\u58ee\u6027\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">try:<\/p>\n<p>    with open(&#39;example.txt&#39;, &#39;w&#39;) as file:<\/p>\n<p>        file.write(&#39;Hello, World!&#39;)<\/p>\n<p>except IOError as e:<\/p>\n<p>    print(f&#39;An error occurred: {e}&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e03\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>Python\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u6587\u4ef6\u8f93\u51fa\u529f\u80fd\uff0c\u652f\u6301\u591a\u79cd\u6587\u4ef6\u683c\u5f0f\u7684\u8bfb\u5199\u64cd\u4f5c\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u9009\u62e9\u5408\u9002\u7684\u6587\u4ef6\u683c\u5f0f\u548c\u8f93\u51fa\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5927\u5927\u63d0\u9ad8\u6570\u636e\u5904\u7406\u7684\u6548\u7387\u548c\u4ee3\u7801\u7684\u53ef\u7ef4\u62a4\u6027\u3002\u719f\u7ec3\u638c\u63e1\u6587\u4ef6\u8f93\u51fa\u7684\u57fa\u672c\u64cd\u4f5c\u548c\u9ad8\u7ea7\u6280\u5de7\uff0c\u5c06\u4e3aPython\u7f16\u7a0b\u4e2d\u7684\u6570\u636e\u5904\u7406\u548c\u5b58\u50a8\u63d0\u4f9b\u5f3a\u6709\u529b\u7684\u652f\u6301\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u4f7f\u7528Python\u5c06\u6570\u636e\u5199\u5165\u6587\u4ef6\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u5185\u7f6e\u7684<code>open()<\/code>\u51fd\u6570\u7ed3\u5408<code>write()<\/code>\u65b9\u6cd5\u5c06\u6570\u636e\u5199\u5165\u6587\u4ef6\u3002\u60a8\u53ef\u4ee5\u9009\u62e9\u4ee5\u6587\u672c\u6a21\u5f0f\u6216\u4e8c\u8fdb\u5236\u6a21\u5f0f\u6253\u5f00\u6587\u4ef6\u3002\u4f8b\u5982\uff0c\u4f7f\u7528<code>with open(&#39;filename.txt&#39;, &#39;w&#39;) as file:<\/code>\u53ef\u4ee5\u786e\u4fdd\u6587\u4ef6\u5728\u64cd\u4f5c\u540e\u81ea\u52a8\u5173\u95ed\u3002\u7136\u540e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528<code>file.write(&quot;\u60a8\u7684\u6570\u636e&quot;)<\/code>\u5c06\u5185\u5bb9\u5199\u5165\u3002<\/p>\n<p><strong>Python\u652f\u6301\u54ea\u4e9b\u6587\u4ef6\u7c7b\u578b\u7684\u8f93\u51fa\uff1f<\/strong><br \/>Python\u53ef\u4ee5\u8f93\u51fa\u591a\u79cd\u6587\u4ef6\u7c7b\u578b\uff0c\u5305\u62ec\u6587\u672c\u6587\u4ef6\uff08\u5982.txt\uff09\u3001CSV\u6587\u4ef6\uff08\u5982.csv\uff09\u3001JSON\u6587\u4ef6\uff08\u5982.json\uff09\u3001Excel\u6587\u4ef6\uff08\u5982.xlsx\uff09\u7b49\u3002\u9488\u5bf9\u4e0d\u540c\u6587\u4ef6\u7c7b\u578b\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u76f8\u5e94\u7684\u5e93\uff0c\u5982<code>csv<\/code>\u6a21\u5757\u5904\u7406CSV\u6587\u4ef6\uff0c<code>json<\/code>\u6a21\u5757\u5904\u7406JSON\u6587\u4ef6\uff0c\u6216<code>pandas<\/code>\u5e93\u5904\u7406Excel\u6587\u4ef6\u3002<\/p>\n<p><strong>\u5982\u4f55\u786e\u4fdd\u5728\u5199\u5165\u6587\u4ef6\u65f6\u4e0d\u4f1a\u8986\u76d6\u5df2\u6709\u6570\u636e\uff1f<\/strong><br \/>\u5982\u679c\u60a8\u5e0c\u671b\u5728\u6587\u4ef6\u672b\u5c3e\u8ffd\u52a0\u5185\u5bb9\u800c\u4e0d\u662f\u8986\u76d6\u539f\u6709\u6570\u636e\uff0c\u53ef\u4ee5\u4f7f\u7528<code>open(&#39;filename.txt&#39;, &#39;a&#39;)<\/code>\u4ee5\u8ffd\u52a0\u6a21\u5f0f\u6253\u5f00\u6587\u4ef6\u3002\u8fd9\u5c06\u4f7f\u60a8\u80fd\u591f\u5c06\u65b0\u6570\u636e\u6dfb\u52a0\u5230\u6587\u4ef6\u7684\u73b0\u6709\u5185\u5bb9\u4e4b\u540e\uff0c\u800c\u4e0d\u4f1a\u5220\u9664\u6216\u8986\u76d6\u539f\u6709\u6570\u636e\u3002\u53ef\u4ee5\u4f7f\u7528<code>file.write(&quot;\u65b0\u6570\u636e&quot;)<\/code>\u6765\u6dfb\u52a0\u5185\u5bb9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u8f93\u51fa\u6587\u4ef6\u7684\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528open()\u51fd\u6570\u3001\u6307\u5b9a\u6a21\u5f0f\uff08\u5982w\u3001a\uff09\u3001\u5229\u7528write()\u65b9\u6cd5\u3001\u4f7f\u7528\u4e0a\u4e0b\u6587\u7ba1 [&hellip;]","protected":false},"author":3,"featured_media":981694,"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\/981684"}],"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=981684"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/981684\/revisions"}],"predecessor-version":[{"id":981697,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/981684\/revisions\/981697"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/981694"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=981684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=981684"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=981684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}