{"id":932676,"date":"2024-12-26T18:02:42","date_gmt":"2024-12-26T10:02:42","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/932676.html"},"modified":"2024-12-26T18:02:44","modified_gmt":"2024-12-26T10:02:44","slug":"python-%e5%88%97%e8%a1%a8%e5%a6%82%e4%bd%95%e4%bf%9d%e5%ad%98","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/932676.html","title":{"rendered":"python \u5217\u8868\u5982\u4f55\u4fdd\u5b58"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25070424\/7bfd711d-54d9-4254-97f6-719c6ec41bdb.webp\" alt=\"python \u5217\u8868\u5982\u4f55\u4fdd\u5b58\" \/><\/p>\n<p><p> <strong>Python\u5217\u8868\u53ef\u4ee5\u901a\u8fc7\u5e8f\u5217\u5316\u3001\u6587\u4ef6\u5b58\u50a8\u548c\u6570\u636e\u5e93\u5b58\u50a8\u7b49\u65b9\u5f0f\u4fdd\u5b58\u3001\u5728\u4fdd\u5b58\u5217\u8868\u65f6\uff0c\u9700\u8981\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u5b58\u50a8\u65b9\u5f0f\u3002<\/strong>\u5176\u4e2d\uff0c\u5e8f\u5217\u5316\u662f\u5c06Python\u5bf9\u8c61\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u6216\u5b57\u8282\u6d41\u7684\u8fc7\u7a0b\uff0c\u5e38\u7528\u7684\u5e8f\u5217\u5316\u5de5\u5177\u6709<code>pickle<\/code>\u548c<code>json<\/code>\uff1b\u6587\u4ef6\u5b58\u50a8\u662f\u5c06\u5217\u8868\u6570\u636e\u4fdd\u5b58\u5230\u6587\u672c\u6587\u4ef6\u6216\u4e8c\u8fdb\u5236\u6587\u4ef6\u4e2d\uff1b\u6570\u636e\u5e93\u5b58\u50a8\u5219\u662f\u5c06\u5217\u8868\u6570\u636e\u4fdd\u5b58\u5230\u5173\u7cfb\u578b\u6570\u636e\u5e93\u6216NoSQL\u6570\u636e\u5e93\u4e2d\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u63a2\u8ba8\u8fd9\u4e9b\u4fdd\u5b58\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u5e8f\u5217\u5316\u4fdd\u5b58<\/p>\n<\/p>\n<p><p>\u5e8f\u5217\u5316\u662f\u4e00\u79cd\u5c06Python\u5bf9\u8c61\u8f6c\u6362\u4e3a\u53ef\u5b58\u50a8\u6216\u4f20\u8f93\u7684\u683c\u5f0f\u7684\u8fc7\u7a0b\u3002Python\u63d0\u4f9b\u4e86\u591a\u79cd\u5e8f\u5217\u5316\u5de5\u5177\uff0c\u5982<code>pickle<\/code>\u548c<code>json<\/code>\uff0c\u5b83\u4eec\u53ef\u4ee5\u5c06\u5217\u8868\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u6216\u5b57\u8282\u6d41\uff0c\u4ece\u800c\u4fbf\u4e8e\u4fdd\u5b58\u548c\u6062\u590d\u3002<\/p>\n<\/p>\n<ol>\n<li>\u4f7f\u7528<code>pickle<\/code>\u6a21\u5757<\/li>\n<\/ol>\n<p><p><code>pickle<\/code>\u6a21\u5757\u662fPython\u7684\u5185\u5efa\u6a21\u5757\uff0c\u7528\u4e8e\u5e8f\u5217\u5316\u548c\u53cd\u5e8f\u5217\u5316Python\u5bf9\u8c61\u3002\u5b83\u53ef\u4ee5\u5c06\u4efb\u4f55Python\u5bf9\u8c61\u8f6c\u6362\u4e3a\u5b57\u8282\u6d41\uff0c\u5e76\u5c06\u5176\u4fdd\u5b58\u5230\u6587\u4ef6\u4e2d\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pickle<\/p>\n<h2><strong>\u5b9a\u4e49\u4e00\u4e2a\u5217\u8868<\/strong><\/h2>\n<p>my_list = [1, 2, 3, 4, 5]<\/p>\n<h2><strong>\u5c06\u5217\u8868\u5e8f\u5217\u5316\u5e76\u4fdd\u5b58\u5230\u6587\u4ef6<\/strong><\/h2>\n<p>with open(&#39;list.pkl&#39;, &#39;wb&#39;) as file:<\/p>\n<p>    pickle.dump(my_list, file)<\/p>\n<h2><strong>\u4ece\u6587\u4ef6\u4e2d\u52a0\u8f7d\u5217\u8868<\/strong><\/h2>\n<p>with open(&#39;list.pkl&#39;, &#39;rb&#39;) as file:<\/p>\n<p>    loaded_list = pickle.load(file)<\/p>\n<p>print(loaded_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><code>pickle<\/code>\u9002\u7528\u4e8e\u5e8f\u5217\u5316\u590d\u6742\u7684Python\u5bf9\u8c61\uff0c\u5305\u62ec\u81ea\u5b9a\u4e49\u7c7b\u7684\u5b9e\u4f8b\u7b49\u3002\u7136\u800c\uff0c<code>pickle<\/code>\u7684\u5e8f\u5217\u5316\u683c\u5f0f\u662fPython\u7279\u6709\u7684\uff0c\u65e0\u6cd5\u4e0e\u5176\u4ed6\u7f16\u7a0b\u8bed\u8a00\u517c\u5bb9\u3002<\/p>\n<\/p>\n<ol start=\"2\">\n<li>\u4f7f\u7528<code>json<\/code>\u6a21\u5757<\/li>\n<\/ol>\n<p><p><code>json<\/code>\u6a21\u5757\u7528\u4e8e\u5c06Python\u5bf9\u8c61\u8f6c\u6362\u4e3aJSON\u683c\u5f0f\u7684\u5b57\u7b26\u4e32\u3002JSON\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u6570\u636e\u4ea4\u6362\u683c\u5f0f\uff0c\u5177\u6709\u826f\u597d\u7684\u8de8\u8bed\u8a00\u517c\u5bb9\u6027\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import json<\/p>\n<h2><strong>\u5b9a\u4e49\u4e00\u4e2a\u5217\u8868<\/strong><\/h2>\n<p>my_list = [1, 2, 3, 4, 5]<\/p>\n<h2><strong>\u5c06\u5217\u8868\u8f6c\u6362\u4e3aJSON\u5b57\u7b26\u4e32\u5e76\u4fdd\u5b58\u5230\u6587\u4ef6<\/strong><\/h2>\n<p>with open(&#39;list.json&#39;, &#39;w&#39;) as file:<\/p>\n<p>    json.dump(my_list, file)<\/p>\n<h2><strong>\u4ece\u6587\u4ef6\u4e2d\u52a0\u8f7d\u5217\u8868<\/strong><\/h2>\n<p>with open(&#39;list.json&#39;, &#39;r&#39;) as file:<\/p>\n<p>    loaded_list = json.load(file)<\/p>\n<p>print(loaded_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c<code>json<\/code>\u4ec5\u652f\u6301\u5e8f\u5217\u5316\u57fa\u672c\u6570\u636e\u7c7b\u578b\uff08\u5982\u5b57\u7b26\u4e32\u3001\u6570\u5b57\u3001\u5217\u8868\u3001\u5b57\u5178\u7b49\uff09\u3002\u5bf9\u4e8e\u590d\u6742\u7684Python\u5bf9\u8c61\uff08\u5982\u81ea\u5b9a\u4e49\u7c7b\u7684\u5b9e\u4f8b\uff09\uff0c\u9700\u8981\u81ea\u5b9a\u4e49\u5e8f\u5217\u5316\u903b\u8f91\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u6587\u4ef6\u5b58\u50a8<\/p>\n<\/p>\n<p><p>\u5c06\u5217\u8868\u4fdd\u5b58\u5230\u6587\u4ef6\u662f\u6700\u76f4\u63a5\u7684\u65b9\u6cd5\u4e4b\u4e00\u3002\u53ef\u4ee5\u9009\u62e9\u5c06\u5217\u8868\u4fdd\u5b58\u4e3a\u6587\u672c\u6587\u4ef6\u6216\u4e8c\u8fdb\u5236\u6587\u4ef6\u3002<\/p>\n<\/p>\n<ol>\n<li>\u4fdd\u5b58\u4e3a\u6587\u672c\u6587\u4ef6<\/li>\n<\/ol>\n<p><p>\u5982\u679c\u5217\u8868\u4ec5\u5305\u542b\u57fa\u672c\u6570\u636e\u7c7b\u578b\uff08\u5982\u5b57\u7b26\u4e32\u6216\u6570\u5b57\uff09\uff0c\u53ef\u4ee5\u5c06\u5176\u4fdd\u5b58\u4e3a\u6587\u672c\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u5b9a\u4e49\u4e00\u4e2a\u5217\u8868<\/p>\n<p>my_list = [&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;]<\/p>\n<h2><strong>\u5c06\u5217\u8868\u4fdd\u5b58\u4e3a\u6587\u672c\u6587\u4ef6<\/strong><\/h2>\n<p>with open(&#39;list.txt&#39;, &#39;w&#39;) as file:<\/p>\n<p>    for item in my_list:<\/p>\n<p>        file.write(f&quot;{item}\\n&quot;)<\/p>\n<h2><strong>\u4ece\u6587\u672c\u6587\u4ef6\u4e2d\u52a0\u8f7d\u5217\u8868<\/strong><\/h2>\n<p>loaded_list = []<\/p>\n<p>with open(&#39;list.txt&#39;, &#39;r&#39;) as file:<\/p>\n<p>    for line in file:<\/p>\n<p>        loaded_list.append(line.strip())<\/p>\n<p>print(loaded_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u4fdd\u5b58\u4e3a\u4e8c\u8fdb\u5236\u6587\u4ef6<\/li>\n<\/ol>\n<p><p>\u5bf9\u4e8e\u9700\u8981\u4fdd\u5b58\u5927\u91cf\u6570\u636e\u7684\u5217\u8868\uff0c\u53ef\u4ee5\u9009\u62e9\u5c06\u5176\u4fdd\u5b58\u4e3a\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u4ee5\u51cf\u5c11\u6587\u4ef6\u5927\u5c0f\u548c\u63d0\u5347\u8bfb\u53d6\u901f\u5ea6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import struct<\/p>\n<h2><strong>\u5b9a\u4e49\u4e00\u4e2a\u5217\u8868<\/strong><\/h2>\n<p>my_list = [1, 2, 3, 4, 5]<\/p>\n<h2><strong>\u5c06\u5217\u8868\u4fdd\u5b58\u4e3a\u4e8c\u8fdb\u5236\u6587\u4ef6<\/strong><\/h2>\n<p>with open(&#39;list.bin&#39;, &#39;wb&#39;) as file:<\/p>\n<p>    file.write(struct.pack(f&#39;{len(my_list)}i&#39;, *my_list))<\/p>\n<h2><strong>\u4ece\u4e8c\u8fdb\u5236\u6587\u4ef6\u4e2d\u52a0\u8f7d\u5217\u8868<\/strong><\/h2>\n<p>with open(&#39;list.bin&#39;, &#39;rb&#39;) as file:<\/p>\n<p>    loaded_data = file.read()<\/p>\n<p>    loaded_list = list(struct.unpack(f&#39;{len(my_list)}i&#39;, loaded_data))<\/p>\n<p>print(loaded_list)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e09\u3001\u6570\u636e\u5e93\u5b58\u50a8<\/p>\n<\/p>\n<p><p>\u5c06\u5217\u8868\u4fdd\u5b58\u5230\u6570\u636e\u5e93\u662f\u4e00\u79cd\u9002\u7528\u4e8e\u9700\u8981\u6301\u4e45\u5316\u548c\u68c0\u7d22\u5927\u91cf\u6570\u636e\u7684\u573a\u666f\u7684\u65b9\u6cd5\u3002\u53ef\u4ee5\u9009\u62e9\u4f7f\u7528\u5173\u7cfb\u578b\u6570\u636e\u5e93\uff08\u5982MySQL\u3001SQLite\uff09\u6216NoSQL\u6570\u636e\u5e93\uff08\u5982MongoDB\uff09\u3002<\/p>\n<\/p>\n<ol>\n<li>\u4f7f\u7528SQLite\u6570\u636e\u5e93<\/li>\n<\/ol>\n<p><p>SQLite\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684\u5d4c\u5165\u5f0f\u6570\u636e\u5e93\uff0c\u9002\u5408\u4fdd\u5b58\u4e2d\u5c0f\u578b\u6570\u636e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import sqlite3<\/p>\n<h2><strong>\u5b9a\u4e49\u4e00\u4e2a\u5217\u8868<\/strong><\/h2>\n<p>my_list = [1, 2, 3, 4, 5]<\/p>\n<h2><strong>\u8fde\u63a5\u5230SQLite\u6570\u636e\u5e93<\/strong><\/h2>\n<p>conn = sqlite3.connect(&#39;list.db&#39;)<\/p>\n<p>cursor = conn.cursor()<\/p>\n<h2><strong>\u521b\u5efa\u8868<\/strong><\/h2>\n<p>cursor.execute(&#39;CREATE TABLE IF NOT EXISTS my_list (id INTEGER PRIMARY KEY, value INTEGER)&#39;)<\/p>\n<h2><strong>\u63d2\u5165\u5217\u8868\u6570\u636e<\/strong><\/h2>\n<p>cursor.executemany(&#39;INSERT INTO my_list (value) VALUES (?)&#39;, [(item,) for item in my_list])<\/p>\n<h2><strong>\u63d0\u4ea4\u66f4\u6539\u5e76\u5173\u95ed\u8fde\u63a5<\/strong><\/h2>\n<p>conn.commit()<\/p>\n<h2><strong>\u4ece\u6570\u636e\u5e93\u4e2d\u52a0\u8f7d\u5217\u8868<\/strong><\/h2>\n<p>cursor.execute(&#39;SELECT value FROM my_list&#39;)<\/p>\n<p>loaded_list = [row[0] for row in cursor.fetchall()]<\/p>\n<p>print(loaded_list)<\/p>\n<p>conn.close()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u4f7f\u7528MongoDB\u6570\u636e\u5e93<\/li>\n<\/ol>\n<p><p>MongoDB\u662f\u4e00\u4e2a\u9762\u5411\u6587\u6863\u7684NoSQL\u6570\u636e\u5e93\uff0c\u9002\u5408\u4fdd\u5b58\u7ed3\u6784\u7075\u6d3b\u7684\u6570\u636e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from pymongo import MongoClient<\/p>\n<h2><strong>\u5b9a\u4e49\u4e00\u4e2a\u5217\u8868<\/strong><\/h2>\n<p>my_list = [1, 2, 3, 4, 5]<\/p>\n<h2><strong>\u8fde\u63a5\u5230MongoDB\u6570\u636e\u5e93<\/strong><\/h2>\n<p>client = MongoClient(&#39;mongodb:\/\/localhost:27017\/&#39;)<\/p>\n<p>db = client[&#39;my_database&#39;]<\/p>\n<p>collection = db[&#39;my_list&#39;]<\/p>\n<h2><strong>\u63d2\u5165\u5217\u8868\u6570\u636e<\/strong><\/h2>\n<p>collection.insert_many([{&#39;value&#39;: item} for item in my_list])<\/p>\n<h2><strong>\u4ece\u6570\u636e\u5e93\u4e2d\u52a0\u8f7d\u5217\u8868<\/strong><\/h2>\n<p>loaded_list = [doc[&#39;value&#39;] for doc in collection.find()]<\/p>\n<p>print(loaded_list)<\/p>\n<p>client.close()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u56db\u3001\u9009\u62e9\u5408\u9002\u7684\u4fdd\u5b58\u65b9\u5f0f<\/p>\n<\/p>\n<p><p>\u9009\u62e9\u4fdd\u5b58\u65b9\u5f0f\u65f6\uff0c\u9700\u8981\u7efc\u5408\u8003\u8651\u4ee5\u4e0b\u51e0\u4e2a\u56e0\u7d20\uff1a<\/p>\n<\/p>\n<ul>\n<li><strong>\u6570\u636e\u7c7b\u578b\u548c\u590d\u6742\u5ea6<\/strong>\uff1a\u5bf9\u4e8e\u7b80\u5355\u7684\u57fa\u672c\u6570\u636e\u7c7b\u578b\uff0c\u6587\u672c\u6587\u4ef6\u548cJSON\u683c\u5f0f\u662f\u4e0d\u9519\u7684\u9009\u62e9\uff1b\u5bf9\u4e8e\u590d\u6742\u7684Python\u5bf9\u8c61\uff0c\u53ef\u4ee5\u8003\u8651\u4f7f\u7528<code>pickle<\/code>\u3002<\/li>\n<li><strong>\u6570\u636e\u91cf<\/strong>\uff1a\u5bf9\u4e8e\u5c0f\u89c4\u6a21\u6570\u636e\uff0c\u6587\u4ef6\u5b58\u50a8\u662f\u8f83\u4e3a\u7b80\u5355\u7684\u65b9\u5f0f\uff1b\u5bf9\u4e8e\u5927\u89c4\u6a21\u6570\u636e\uff0c\u6570\u636e\u5e93\u5b58\u50a8\u66f4\u4e3a\u5408\u9002\u3002<\/li>\n<li><strong>\u8de8\u8bed\u8a00\u517c\u5bb9\u6027<\/strong>\uff1a\u5982\u679c\u9700\u8981\u4e0e\u5176\u4ed6\u7f16\u7a0b\u8bed\u8a00\u5171\u4eab\u6570\u636e\uff0c\u5efa\u8bae\u4f7f\u7528JSON\u683c\u5f0f\u3002<\/li>\n<li><strong>\u6027\u80fd\u548c\u6269\u5c55\u6027<\/strong>\uff1a\u6570\u636e\u5e93\u5b58\u50a8\u63d0\u4f9b\u4e86\u66f4\u597d\u7684\u67e5\u8be2\u6027\u80fd\u548c\u6269\u5c55\u6027\uff0c\u9002\u5408\u9700\u8981\u9891\u7e41\u6570\u636e\u68c0\u7d22\u7684\u5e94\u7528\u3002<\/li>\n<\/ul>\n<p><p>\u603b\u7ed3\u6765\u8bf4\uff0cPython\u5217\u8868\u7684\u4fdd\u5b58\u65b9\u5f0f\u6709\u591a\u79cd\u9009\u62e9\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u5e94\u7528\u573a\u666f\u548c\u9700\u6c42\uff0c\u9009\u62e9\u5408\u9002\u7684\u4fdd\u5b58\u65b9\u5f0f\uff0c\u4ee5\u786e\u4fdd\u6570\u636e\u7684\u6301\u4e45\u5316\u548c\u53ef\u8bbf\u95ee\u6027\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5c06Python\u5217\u8868\u4fdd\u5b58\u5230\u6587\u4ef6\u4e2d\uff1f<\/strong><br \/>\u8981\u5c06Python\u5217\u8868\u4fdd\u5b58\u5230\u6587\u4ef6\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u5185\u7f6e\u7684<code>open()<\/code>\u51fd\u6570\u7ed3\u5408<code>write()<\/code>\u65b9\u6cd5\u5c06\u5176\u5199\u5165\u6587\u672c\u6587\u4ef6\u3002\u5bf9\u4e8e\u66f4\u590d\u6742\u7684\u6570\u636e\u7ed3\u6784\uff0c\u63a8\u8350\u4f7f\u7528<code>json<\/code>\u6a21\u5757\uff0c\u5c06\u5217\u8868\u8f6c\u6362\u4e3aJSON\u683c\u5f0f\u5e76\u4fdd\u5b58\u3002\u4ee3\u7801\u793a\u4f8b\uff1a  <\/p>\n<pre><code class=\"language-python\">import json\n\nmy_list = [1, 2, 3, 4, 5]\nwith open(&#39;my_list.json&#39;, &#39;w&#39;) as f:\n    json.dump(my_list, f)\n<\/code><\/pre>\n<p>\u8fd9\u6837\u53ef\u4ee5\u65b9\u4fbf\u5730\u5c06\u5217\u8868\u4fdd\u5b58\u5728\u6587\u4ef6\u4e2d\uff0c\u540e\u7eed\u4e5f\u53ef\u4ee5\u8f7b\u677e\u8bfb\u53d6\u3002<\/p>\n<p><strong>\u5982\u4f55\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6\u4fdd\u5b58\u7684Python\u5217\u8868\uff1f<\/strong><br \/>\u4f7f\u7528\u76f8\u5e94\u7684\u8bfb\u53d6\u65b9\u6cd5\uff0c\u7ed3\u5408<code>json<\/code>\u6a21\u5757\u53ef\u4ee5\u8f7b\u677e\u6062\u590d\u4fdd\u5b58\u7684\u5217\u8868\u3002\u6253\u5f00\u6587\u4ef6\u540e\uff0c\u4f7f\u7528<code>json.load()<\/code>\u65b9\u6cd5\u8bfb\u53d6\u6570\u636e\u5e76\u8f6c\u6362\u56de\u5217\u8868\u3002\u4ee5\u4e0b\u662f\u793a\u4f8b\u4ee3\u7801\uff1a  <\/p>\n<pre><code class=\"language-python\">import json\n\nwith open(&#39;my_list.json&#39;, &#39;r&#39;) as f:\n    loaded_list = json.load(f)\nprint(loaded_list)  # \u8f93\u51fa: [1, 2, 3, 4, 5]\n<\/code><\/pre>\n<p>\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u53ef\u4ee5\u5feb\u901f\u6062\u590d\u4e4b\u524d\u4fdd\u5b58\u7684\u6570\u636e\u3002<\/p>\n<p><strong>Python\u5217\u8868\u4fdd\u5b58\u7684\u6700\u4f73\u5b9e\u8df5\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>\u5728\u4fdd\u5b58Python\u5217\u8868\u65f6\uff0c\u9009\u62e9\u5408\u9002\u7684\u6570\u636e\u683c\u5f0f\u975e\u5e38\u91cd\u8981\u3002\u5bf9\u4e8e\u7b80\u5355\u7684\u5217\u8868\uff0c\u6587\u672c\u6587\u4ef6\u6216CSV\u683c\u5f0f\u90fd\u53ef\u4ee5\u3002\u800c\u5bf9\u4e8e\u590d\u6742\u6570\u636e\uff0c\u63a8\u8350\u4f7f\u7528JSON\u6216Pickle\u683c\u5f0f\u3002JSON\u5177\u6709\u826f\u597d\u7684\u53ef\u8bfb\u6027\uff0c\u9002\u5408\u4e0e\u5176\u4ed6\u8bed\u8a00\u7684\u6570\u636e\u4ea4\u6362\uff1b\u800cPickle\u5219\u9002\u5408Python\u5185\u90e8\u4f7f\u7528\uff0c\u80fd\u591f\u4fdd\u5b58\u51e0\u4e4e\u6240\u6709Python\u5bf9\u8c61\u3002\u786e\u4fdd\u5728\u4fdd\u5b58\u548c\u8bfb\u53d6\u65f6\uff0c\u7406\u89e3\u6240\u7528\u683c\u5f0f\u7684\u4f18\u7f3a\u70b9\uff0c\u6709\u52a9\u4e8e\u907f\u514d\u6570\u636e\u4e22\u5931\u548c\u517c\u5bb9\u6027\u95ee\u9898\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u5217\u8868\u53ef\u4ee5\u901a\u8fc7\u5e8f\u5217\u5316\u3001\u6587\u4ef6\u5b58\u50a8\u548c\u6570\u636e\u5e93\u5b58\u50a8\u7b49\u65b9\u5f0f\u4fdd\u5b58\u3001\u5728\u4fdd\u5b58\u5217\u8868\u65f6\uff0c\u9700\u8981\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u5b58\u50a8\u65b9 [&hellip;]","protected":false},"author":3,"featured_media":932679,"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\/932676"}],"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=932676"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/932676\/revisions"}],"predecessor-version":[{"id":932681,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/932676\/revisions\/932681"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/932679"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=932676"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=932676"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=932676"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}