{"id":1101033,"date":"2025-01-08T15:45:30","date_gmt":"2025-01-08T07:45:30","guid":{"rendered":""},"modified":"2025-01-08T15:45:33","modified_gmt":"2025-01-08T07:45:33","slug":"python%e4%b8%ad%e5%a6%82%e4%bd%95%e5%b0%86%e5%88%97%e8%a1%a8%e5%86%99%e5%85%a5txt-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1101033.html","title":{"rendered":"python\u4e2d\u5982\u4f55\u5c06\u5217\u8868\u5199\u5165txt"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25064002\/92e1deab-6ac4-4149-aca3-2fe582c5fc3b.webp\" alt=\"python\u4e2d\u5982\u4f55\u5c06\u5217\u8868\u5199\u5165txt\" \/><\/p>\n<p><p> \u5728Python\u4e2d\u5c06\u5217\u8868\u5199\u5165txt\u6587\u4ef6\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5177\u4f53\u65b9\u6cd5\u5305\u62ec<strong>\u4f7f\u7528open\u51fd\u6570\u3001\u4f7f\u7528with\u8bed\u53e5\u3001\u4f7f\u7528csv\u6a21\u5757\u3001\u4f7f\u7528pickle\u6a21\u5757<\/strong>\u7b49\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5176\u4e2d\u4e00\u79cd\u65b9\u6cd5\uff0c\u4f7f\u7528with\u8bed\u53e5\u5c06\u5217\u8868\u5199\u5165txt\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><p><strong>\u4f7f\u7528with\u8bed\u53e5\u662f\u4e00\u79cd\u63a8\u8350\u7684\u65b9\u6cd5\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u81ea\u52a8\u5904\u7406\u6587\u4ef6\u7684\u6253\u5f00\u548c\u5173\u95ed\uff0c\u65e0\u9700\u624b\u52a8\u8c03\u7528close\u65b9\u6cd5\u3002<\/strong><\/p>\n<\/p>\n<p><h2>\u4e00\u3001\u4f7f\u7528open\u51fd\u6570<\/h2>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c\u6700\u57fa\u672c\u7684\u65b9\u6cd5\u662f\u4f7f\u7528<code>open<\/code>\u51fd\u6570\u6765\u6253\u5f00\u6587\u4ef6\uff0c\u4e4b\u540e\u4f7f\u7528<code>write<\/code>\u65b9\u6cd5\u5c06\u5217\u8868\u7684\u5185\u5bb9\u5199\u5165\u6587\u4ef6\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<p><h3>1.1 \u6253\u5f00\u6587\u4ef6<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">file = open(&#39;output.txt&#39;, &#39;w&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>open<\/code>\u51fd\u6570\u6253\u5f00\u4e00\u4e2a\u540d\u4e3a<code>output.txt<\/code>\u7684\u6587\u4ef6\uff0c\u5e76\u4f7f\u7528<code>&#39;w&#39;<\/code>\u6a21\u5f0f\u6765\u5199\u5165\u6587\u4ef6\u3002\u5982\u679c\u6587\u4ef6\u4e0d\u5b58\u5728\uff0cPython\u5c06\u81ea\u52a8\u521b\u5efa\u5b83\u3002\u5982\u679c\u6587\u4ef6\u5b58\u5728\uff0c\u6240\u6709\u73b0\u6709\u5185\u5bb9\u5c06\u88ab\u5220\u9664\u3002<\/p>\n<\/p>\n<p><h3>1.2 \u5199\u5165\u6587\u4ef6<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">my_list = [&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;]<\/p>\n<p>for item in my_list:<\/p>\n<p>    file.write(item + &#39;\\n&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6211\u4eec\u6709\u4e00\u4e2a\u5305\u542b\u5b57\u7b26\u4e32\u7684\u5217\u8868<code>my_list<\/code>\u3002\u4f7f\u7528<code>for<\/code>\u5faa\u73af\uff0c\u6211\u4eec\u53ef\u4ee5\u904d\u5386\u5217\u8868\u4e2d\u7684\u6bcf\u4e00\u4e2a\u5143\u7d20\uff0c\u5e76\u5c06\u5176\u5199\u5165\u6587\u4ef6\u3002\u6ce8\u610f\uff0c\u6211\u4eec\u5728\u6bcf\u4e2a\u5143\u7d20\u540e\u9762\u52a0\u4e0a\u4e86\u4e00\u4e2a\u6362\u884c\u7b26<code>\\n<\/code>\uff0c\u4ee5\u786e\u4fdd\u6bcf\u4e2a\u5143\u7d20\u90fd\u5360\u636e\u6587\u4ef6\u4e2d\u7684\u4e00\u884c\u3002<\/p>\n<\/p>\n<p><h3>1.3 \u5173\u95ed\u6587\u4ef6<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">file.close()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5199\u5165\u5b8c\u6210\u540e\uff0c\u8bb0\u5f97\u4f7f\u7528<code>close<\/code>\u65b9\u6cd5\u5173\u95ed\u6587\u4ef6\u3002\u8fd9\u662f\u4e00\u4e2a\u597d\u4e60\u60ef\uff0c\u53ef\u4ee5\u907f\u514d\u6587\u4ef6\u8d44\u6e90\u6cc4\u9732\u3002<\/p>\n<\/p>\n<p><h2>\u4e8c\u3001\u4f7f\u7528with\u8bed\u53e5<\/h2>\n<\/p>\n<p><p>\u4f7f\u7528<code>with<\/code>\u8bed\u53e5\u53ef\u4ee5\u81ea\u52a8\u7ba1\u7406\u8d44\u6e90\uff0c\u786e\u4fdd\u6587\u4ef6\u5728\u64cd\u4f5c\u5b8c\u6210\u540e\u81ea\u52a8\u5173\u95ed\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<p><h3>2.1 \u6253\u5f00\u6587\u4ef6\u5e76\u5199\u5165\u5185\u5bb9<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">my_list = [&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;]<\/p>\n<p>with open(&#39;output.txt&#39;, &#39;w&#39;) as file:<\/p>\n<p>    for item in my_list:<\/p>\n<p>        file.write(item + &#39;\\n&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>with open<\/code>\u6765\u6253\u5f00\u6587\u4ef6\uff0c\u5e76\u4f7f\u7528<code>&#39;w&#39;<\/code>\u6a21\u5f0f\u5199\u5165\u6587\u4ef6\u3002<code>with<\/code>\u8bed\u53e5\u4f1a\u5728\u5757\u7ed3\u675f\u65f6\u81ea\u52a8\u5173\u95ed\u6587\u4ef6\uff0c\u65e0\u9700\u663e\u5f0f\u8c03\u7528<code>close<\/code>\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><h2>\u4e09\u3001\u4f7f\u7528csv\u6a21\u5757<\/h2>\n<\/p>\n<p><p><code>csv<\/code>\u6a21\u5757\u975e\u5e38\u9002\u5408\u5904\u7406\u7ed3\u6784\u5316\u6570\u636e\uff0c\u4f8b\u5982\u8868\u683c\u6570\u636e\u3002\u53ef\u4ee5\u4f7f\u7528<code>csv<\/code>\u6a21\u5757\u5c06\u5217\u8868\u5199\u5165txt\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h3>3.1 \u5bfc\u5165csv\u6a21\u5757<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">import csv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>3.2 \u5199\u5165\u6587\u4ef6<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">my_list = [&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;]<\/p>\n<p>with open(&#39;output.txt&#39;, &#39;w&#39;, newline=&#39;&#39;) as file:<\/p>\n<p>    writer = csv.writer(file)<\/p>\n<p>    for item in my_list:<\/p>\n<p>        writer.writerow([item])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u9996\u5148\u5bfc\u5165<code>csv<\/code>\u6a21\u5757\uff0c\u7136\u540e\u4f7f\u7528<code>open<\/code>\u51fd\u6570\u6253\u5f00\u6587\u4ef6\u3002<code>csv.writer<\/code>\u5bf9\u8c61\u7528\u4e8e\u5c06\u5217\u8868\u5199\u5165\u6587\u4ef6\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u6211\u4eec\u5c06\u6bcf\u4e2a\u5143\u7d20\u4f5c\u4e3a\u5355\u72ec\u7684\u4e00\u884c\u5199\u5165\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h2>\u56db\u3001\u4f7f\u7528pickle\u6a21\u5757<\/h2>\n<\/p>\n<p><p><code>pickle<\/code>\u6a21\u5757\u53ef\u4ee5\u5c06Python\u5bf9\u8c61\u5e8f\u5217\u5316\uff0c\u5e76\u5199\u5165\u6587\u4ef6\u3002\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u5199\u5165\u590d\u6742\u6570\u636e\u7ed3\u6784\uff0c\u4f8b\u5982\u5305\u542b\u5d4c\u5957\u5217\u8868\u7684\u5217\u8868\u3002<\/p>\n<\/p>\n<p><h3>4.1 \u5bfc\u5165pickle\u6a21\u5757<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">import pickle<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>4.2 \u5199\u5165\u6587\u4ef6<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">my_list = [&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;]<\/p>\n<p>with open(&#39;output.pkl&#39;, &#39;wb&#39;) as file:<\/p>\n<p>    pickle.dump(my_list, file)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>pickle.dump<\/code>\u65b9\u6cd5\u5c06\u5217\u8868\u5e8f\u5217\u5316\uff0c\u5e76\u5199\u5165\u6587\u4ef6\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u6211\u4eec\u4f7f\u7528<code>&#39;wb&#39;<\/code>\u6a21\u5f0f\u6765\u6253\u5f00\u6587\u4ef6\uff0c\u56e0\u4e3a\u6211\u4eec\u5199\u5165\u7684\u662f\u4e8c\u8fdb\u5236\u6570\u636e\u3002<\/p>\n<\/p>\n<p><h2>\u4e94\u3001\u4f7f\u7528json\u6a21\u5757<\/h2>\n<\/p>\n<p><p><code>json<\/code>\u6a21\u5757\u53ef\u4ee5\u5c06Python\u5bf9\u8c61\u8f6c\u6362\u4e3aJSON\u683c\u5f0f\uff0c\u5e76\u5199\u5165\u6587\u4ef6\u3002\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u5199\u5165\u7b80\u5355\u6570\u636e\u7ed3\u6784\uff0c\u4f8b\u5982\u5217\u8868\u3001\u5b57\u5178\u7b49\u3002<\/p>\n<\/p>\n<p><h3>5.1 \u5bfc\u5165json\u6a21\u5757<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">import json<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>5.2 \u5199\u5165\u6587\u4ef6<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">my_list = [&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;]<\/p>\n<p>with open(&#39;output.json&#39;, &#39;w&#39;) as file:<\/p>\n<p>    json.dump(my_list, file)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>json.dump<\/code>\u65b9\u6cd5\u5c06\u5217\u8868\u8f6c\u6362\u4e3aJSON\u683c\u5f0f\uff0c\u5e76\u5199\u5165\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h2>\u516d\u3001\u4f7f\u7528pandas\u6a21\u5757<\/h2>\n<\/p>\n<p><p><code>pandas<\/code>\u6a21\u5757\u975e\u5e38\u9002\u5408\u5904\u7406\u7ed3\u6784\u5316\u6570\u636e\uff0c\u5e76\u53ef\u4ee5\u5c06\u6570\u636e\u5199\u5165txt\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h3>6.1 \u5bfc\u5165pandas\u6a21\u5757<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>6.2 \u5199\u5165\u6587\u4ef6<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">my_list = [&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;]<\/p>\n<p>df = pd.DataFrame(my_list, columns=[&#39;Fruits&#39;])<\/p>\n<p>df.to_csv(&#39;output.txt&#39;, index=False, header=False)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u9996\u5148\u5bfc\u5165<code>pandas<\/code>\u6a21\u5757\uff0c\u7136\u540e\u5c06\u5217\u8868\u8f6c\u6362\u4e3a<code>pandas<\/code>\u6570\u636e\u6846\u3002\u4f7f\u7528<code>to_csv<\/code>\u65b9\u6cd5\u5c06\u6570\u636e\u6846\u5199\u5165txt\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h2>\u4e03\u3001\u4f7f\u7528numpy\u6a21\u5757<\/h2>\n<\/p>\n<p><p><code>numpy<\/code>\u6a21\u5757\u975e\u5e38\u9002\u5408\u5904\u7406\u6570\u503c\u6570\u636e\uff0c\u5e76\u53ef\u4ee5\u5c06\u6570\u636e\u5199\u5165txt\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h3>7.1 \u5bfc\u5165numpy\u6a21\u5757<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>7.2 \u5199\u5165\u6587\u4ef6<\/h3>\n<\/p>\n<p><pre><code class=\"language-python\">my_list = [&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;]<\/p>\n<p>np.savetxt(&#39;output.txt&#39;, my_list, fmt=&#39;%s&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u9996\u5148\u5bfc\u5165<code>numpy<\/code>\u6a21\u5757\uff0c\u7136\u540e\u4f7f\u7528<code>savetxt<\/code>\u65b9\u6cd5\u5c06\u5217\u8868\u5199\u5165txt\u6587\u4ef6\u3002<code>fmt=&#39;%s&#39;<\/code>\u53c2\u6570\u6307\u5b9a\u4e86\u8f93\u51fa\u683c\u5f0f\u4e3a\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><h2>\u516b\u3001\u603b\u7ed3<\/h2>\n<\/p>\n<p><p>\u603b\u7684\u6765\u8bf4\uff0cPython\u63d0\u4f9b\u4e86\u591a\u79cd\u65b9\u6cd5\u5c06\u5217\u8868\u5199\u5165txt\u6587\u4ef6\uff0c\u5177\u4f53\u65b9\u6cd5\u5305\u62ec<strong>\u4f7f\u7528open\u51fd\u6570\u3001\u4f7f\u7528with\u8bed\u53e5\u3001\u4f7f\u7528csv\u6a21\u5757\u3001\u4f7f\u7528pickle\u6a21\u5757\u3001\u4f7f\u7528json\u6a21\u5757\u3001\u4f7f\u7528pandas\u6a21\u5757\u3001\u4f7f\u7528numpy\u6a21\u5757<\/strong>\u7b49\u3002\u6bcf\u79cd\u65b9\u6cd5\u90fd\u6709\u5176\u4f18\u7f3a\u70b9\uff0c\u9009\u62e9\u54ea\u79cd\u65b9\u6cd5\u53d6\u51b3\u4e8e\u5177\u4f53\u7684\u5e94\u7528\u573a\u666f\u548c\u9700\u6c42\u3002\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u80fd\u591f\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u7406\u89e3\u548c\u638c\u63e1Python\u4e2d\u5c06\u5217\u8868\u5199\u5165txt\u6587\u4ef6\u7684\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5c06Python\u5217\u8868\u7684\u5185\u5bb9\u683c\u5f0f\u5316\u4e3a\u5b57\u7b26\u4e32\u4ee5\u4fbf\u5199\u5165txt\u6587\u4ef6\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>join()<\/code>\u65b9\u6cd5\u5c06\u5217\u8868\u4e2d\u7684\u5143\u7d20\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u3002\u9996\u5148\uff0c\u4f60\u9700\u8981\u786e\u4fdd\u5217\u8868\u4e2d\u7684\u6240\u6709\u5143\u7d20\u90fd\u662f\u5b57\u7b26\u4e32\u7c7b\u578b\u3002\u5982\u679c\u5217\u8868\u4e2d\u5305\u542b\u5176\u4ed6\u6570\u636e\u7c7b\u578b\uff0c\u53ef\u4ee5\u4f7f\u7528\u5217\u8868\u63a8\u5bfc\u5f0f\u5c06\u5176\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u3002\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a  <\/p>\n<pre><code class=\"language-python\">my_list = [1, 2, 3, &#39;hello&#39;, &#39;world&#39;]\nformatted_string = &#39;\\n&#39;.join(str(item) for item in my_list)\n<\/code><\/pre>\n<p>\u6b64\u4ee3\u7801\u5c06\u5217\u8868\u4e2d\u7684\u6bcf\u4e2a\u5143\u7d20\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\uff0c\u5e76\u7528\u6362\u884c\u7b26\u5206\u9694\u3002<\/p>\n<p><strong>\u5199\u5165txt\u6587\u4ef6\u65f6\u5982\u4f55\u907f\u514d\u8986\u76d6\u5df2\u6709\u5185\u5bb9\uff1f<\/strong><br \/>\u5728\u6253\u5f00\u6587\u4ef6\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code>&#39;a&#39;<\/code>\u6a21\u5f0f\uff08\u9644\u52a0\u6a21\u5f0f\uff09\u6765\u5199\u5165\u6570\u636e\uff0c\u800c\u4e0d\u662f<code>&#39;w&#39;<\/code>\u6a21\u5f0f\uff08\u5199\u5165\u6a21\u5f0f\uff09\uff0c\u540e\u8005\u4f1a\u8986\u76d6\u6587\u4ef6\u4e2d\u7684\u73b0\u6709\u5185\u5bb9\u3002\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a  <\/p>\n<pre><code class=\"language-python\">with open(&#39;output.txt&#39;, &#39;a&#39;) as file:\n    file.write(formatted_string + &#39;\\n&#39;)\n<\/code><\/pre>\n<p>\u8fd9\u6837\uff0c\u65b0\u7684\u5185\u5bb9\u5c06\u88ab\u8ffd\u52a0\u5230\u6587\u4ef6\u7684\u672b\u5c3e\uff0c\u800c\u4e0d\u4f1a\u5220\u9664\u4e4b\u524d\u7684\u6570\u636e\u3002<\/p>\n<p><strong>\u53ef\u4ee5\u4f7f\u7528\u54ea\u4e9b\u65b9\u6cd5\u8bfb\u53d6txt\u6587\u4ef6\u4e2d\u7684\u5217\u8868\u6570\u636e\uff1f<\/strong><br \/>\u8bfb\u53d6txt\u6587\u4ef6\u4e2d\u7684\u6570\u636e\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code>readlines()<\/code>\u65b9\u6cd5\u5c06\u6bcf\u4e00\u884c\u8bfb\u53d6\u4e3a\u5217\u8868\u5143\u7d20\u3002\u968f\u540e\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528<code>strip()<\/code>\u65b9\u6cd5\u53bb\u9664\u6bcf\u884c\u672b\u5c3e\u7684\u6362\u884c\u7b26\u3002\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a  <\/p>\n<pre><code class=\"language-python\">with open(&#39;output.txt&#39;, &#39;r&#39;) as file:\n    lines = [line.strip() for line in file.readlines()]\n<\/code><\/pre>\n<p>\u8fd9\u5c06\u8fd4\u56de\u4e00\u4e2a\u5305\u542b\u6587\u4ef6\u4e2d\u6240\u6709\u884c\u7684\u5217\u8868\uff0c\u9002\u5408\u4e8e\u540e\u7eed\u5904\u7406\u6216\u5206\u6790\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\u5c06\u5217\u8868\u5199\u5165txt\u6587\u4ef6\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5177\u4f53\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528open\u51fd\u6570\u3001\u4f7f\u7528with\u8bed\u53e5\u3001\u4f7f\u7528csv\u6a21 [&hellip;]","protected":false},"author":3,"featured_media":1101044,"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\/1101033"}],"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=1101033"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1101033\/revisions"}],"predecessor-version":[{"id":1101046,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1101033\/revisions\/1101046"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1101044"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1101033"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1101033"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1101033"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}