{"id":1106014,"date":"2025-01-08T16:36:14","date_gmt":"2025-01-08T08:36:14","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1106014.html"},"modified":"2025-01-08T16:36:16","modified_gmt":"2025-01-08T08:36:16","slug":"%e6%95%b0%e6%8d%ae%e5%ba%93%e5%a6%82%e4%bd%95%e6%8a%8apython%e7%94%9f%e6%88%90%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1106014.html","title":{"rendered":"\u6570\u636e\u5e93\u5982\u4f55\u628apython\u751f\u6210\u6587\u4ef6"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25070644\/487b758a-0e95-483d-a12d-ecba2538acc2.webp\" alt=\"\u6570\u636e\u5e93\u5982\u4f55\u628apython\u751f\u6210\u6587\u4ef6\" \/><\/p>\n<p><p> <strong>\u6570\u636e\u5e93\u5982\u4f55\u628apython\u751f\u6210\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p>\u901a\u8fc7Python\u5c06\u6570\u636e\u751f\u6210\u6587\u4ef6\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u5b9e\u73b0\uff0c<strong>\u5305\u62ec\u4f7f\u7528pandas\u5e93\u5bfc\u51fa\u6570\u636e\u5230CSV\u6587\u4ef6\u3001\u4f7f\u7528SQLAlchemy\u5e93\u5bfc\u51fa\u6570\u636e\u5230Excel\u6587\u4ef6\u3001\u4f7f\u7528SQLite\u5e93\u5bfc\u51fa\u6570\u636e\u5230SQL\u6587\u4ef6<\/strong>\u7b49\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u8fd9\u4e9b\u65b9\u6cd5\u6765\u5b9e\u73b0\u6570\u636e\u7684\u5bfc\u51fa\u3002<\/p>\n<\/p>\n<p><p><strong>\u4f7f\u7528pandas\u5e93\u5bfc\u51fa\u6570\u636e\u5230CSV\u6587\u4ef6<\/strong>\u662f\u6700\u5e38\u7528\u4e14\u7b80\u4fbf\u7684\u65b9\u6cd5\u4e4b\u4e00\u3002\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5c06\u6570\u636e\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u53d6\u51fa\u6765\uff0c\u5e76\u5c06\u5176\u8f6c\u6362\u4e3apandas DataFrame\u683c\u5f0f\u3002\u63a5\u7740\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528DataFrame\u7684<code>to_csv<\/code>\u65b9\u6cd5\u5c06\u6570\u636e\u5bfc\u51fa\u5230CSV\u6587\u4ef6\u4e2d\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u7684\u64cd\u4f5c\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4f7f\u7528pandas\u5e93\u5bfc\u51fa\u6570\u636e\u5230CSV\u6587\u4ef6<\/p>\n<\/p>\n<p><p>1.1\u3001\u5b89\u88c5pandas\u5e93<\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86pandas\u5e93\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">pip install pandas<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>1.2\u3001\u8bfb\u53d6\u6570\u636e\u5e93\u6570\u636e<\/p>\n<\/p>\n<p><p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528pandas\u7684<code>read_sql<\/code>\u65b9\u6cd5\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u53d6\u6570\u636e\u3002\u5047\u8bbe\u6211\u4eec\u4f7f\u7528\u7684\u662fSQLite\u6570\u636e\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u8bfb\u53d6\u6570\u636e\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<p>import sqlite3<\/p>\n<h2><strong>\u8fde\u63a5\u5230SQLite\u6570\u636e\u5e93<\/strong><\/h2>\n<p>conn = sqlite3.connect(&#39;example.db&#39;)<\/p>\n<h2><strong>\u8bfb\u53d6\u6570\u636e\u5230pandas DataFrame<\/strong><\/h2>\n<p>df = pd.read_sql(&#39;SELECT * FROM table_name&#39;, conn)<\/p>\n<h2><strong>\u5173\u95ed\u6570\u636e\u5e93\u8fde\u63a5<\/strong><\/h2>\n<p>conn.close()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>1.3\u3001\u5bfc\u51fa\u6570\u636e\u5230CSV\u6587\u4ef6<\/p>\n<\/p>\n<p><p>\u8bfb\u53d6\u6570\u636e\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528DataFrame\u7684<code>to_csv<\/code>\u65b9\u6cd5\u5c06\u6570\u636e\u5bfc\u51fa\u5230CSV\u6587\u4ef6\u4e2d\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u5bfc\u51fa\u6570\u636e\u5230CSV\u6587\u4ef6<\/p>\n<p>df.to_csv(&#39;output.csv&#39;, index=False)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6837\uff0c\u6211\u4eec\u5c31\u6210\u529f\u5730\u5c06\u6570\u636e\u5e93\u4e2d\u7684\u6570\u636e\u5bfc\u51fa\u4e86CSV\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u4f7f\u7528SQLAlchemy\u5e93\u5bfc\u51fa\u6570\u636e\u5230Excel\u6587\u4ef6<\/p>\n<\/p>\n<p><p>2.1\u3001\u5b89\u88c5SQLAlchemy\u548copenpyxl\u5e93<\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86SQLAlchemy\u548copenpyxl\u5e93\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">pip install sqlalchemy openpyxl<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>2.2\u3001\u8bfb\u53d6\u6570\u636e\u5e93\u6570\u636e<\/p>\n<\/p>\n<p><p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528SQLAlchemy\u5e93\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u53d6\u6570\u636e\u3002\u5047\u8bbe\u6211\u4eec\u4f7f\u7528\u7684\u662fPostgreSQL\u6570\u636e\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u8bfb\u53d6\u6570\u636e\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sqlalchemy import create_engine<\/p>\n<p>import pandas as pd<\/p>\n<h2><strong>\u521b\u5efa\u6570\u636e\u5e93\u8fde\u63a5\u5f15\u64ce<\/strong><\/h2>\n<p>engine = create_engine(&#39;postgresql:\/\/username:password@localhost:5432\/mydatabase&#39;)<\/p>\n<h2><strong>\u8bfb\u53d6\u6570\u636e\u5230pandas DataFrame<\/strong><\/h2>\n<p>df = pd.read_sql(&#39;SELECT * FROM table_name&#39;, engine)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>2.3\u3001\u5bfc\u51fa\u6570\u636e\u5230Excel\u6587\u4ef6<\/p>\n<\/p>\n<p><p>\u8bfb\u53d6\u6570\u636e\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528DataFrame\u7684<code>to_excel<\/code>\u65b9\u6cd5\u5c06\u6570\u636e\u5bfc\u51fa\u5230Excel\u6587\u4ef6\u4e2d\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u5bfc\u51fa\u6570\u636e\u5230Excel\u6587\u4ef6<\/p>\n<p>df.to_excel(&#39;output.xlsx&#39;, index=False)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6837\uff0c\u6211\u4eec\u5c31\u6210\u529f\u5730\u5c06\u6570\u636e\u5e93\u4e2d\u7684\u6570\u636e\u5bfc\u51fa\u4e86Excel\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u4f7f\u7528SQLite\u5e93\u5bfc\u51fa\u6570\u636e\u5230SQL\u6587\u4ef6<\/p>\n<\/p>\n<p><p>3.1\u3001\u5b89\u88c5SQLite\u5e93<\/p>\n<\/p>\n<p><p>SQLite\u5e93\u901a\u5e38\u662fPython\u5185\u7f6e\u7684\uff0c\u65e0\u9700\u5355\u72ec\u5b89\u88c5\u3002\u5982\u679c\u4f60\u9700\u8981\u5b89\u88c5\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">pip install pysqlite3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>3.2\u3001\u8bfb\u53d6\u6570\u636e\u5e93\u6570\u636e<\/p>\n<\/p>\n<p><p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528SQLite\u5e93\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u53d6\u6570\u636e\u3002\u4ee5\u4e0b\u662f\u8bfb\u53d6\u6570\u636e\u7684\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import sqlite3<\/p>\n<h2><strong>\u8fde\u63a5\u5230SQLite\u6570\u636e\u5e93<\/strong><\/h2>\n<p>conn = sqlite3.connect(&#39;example.db&#39;)<\/p>\n<h2><strong>\u521b\u5efa\u6e38\u6807\u5bf9\u8c61<\/strong><\/h2>\n<p>cursor = conn.cursor()<\/p>\n<h2><strong>\u6267\u884cSQL\u67e5\u8be2<\/strong><\/h2>\n<p>cursor.execute(&#39;SELECT * FROM table_name&#39;)<\/p>\n<h2><strong>\u83b7\u53d6\u67e5\u8be2\u7ed3\u679c<\/strong><\/h2>\n<p>rows = cursor.fetchall()<\/p>\n<h2><strong>\u5173\u95ed\u6e38\u6807\u548c\u6570\u636e\u5e93\u8fde\u63a5<\/strong><\/h2>\n<p>cursor.close()<\/p>\n<p>conn.close()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>3.3\u3001\u5bfc\u51fa\u6570\u636e\u5230SQL\u6587\u4ef6<\/p>\n<\/p>\n<p><p>\u8bfb\u53d6\u6570\u636e\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u6570\u636e\u5199\u5165SQL\u6587\u4ef6\u4e2d\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u5199\u5165SQL\u6587\u4ef6<\/p>\n<p>with open(&#39;output.sql&#39;, &#39;w&#39;) as f:<\/p>\n<p>    for row in rows:<\/p>\n<p>        f.write(f&quot;INSERT INTO table_name VALUES ({&#39;, &#39;.join(map(str, row))});\\n&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6837\uff0c\u6211\u4eec\u5c31\u6210\u529f\u5730\u5c06\u6570\u636e\u5e93\u4e2d\u7684\u6570\u636e\u5bfc\u51fa\u4e86SQL\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u4f7f\u7528\u5176\u4ed6\u5e93\u5bfc\u51fa\u6570\u636e<\/p>\n<\/p>\n<p><p>\u9664\u4e86\u4e0a\u8ff0\u65b9\u6cd5\u5916\uff0c\u8fd8\u6709\u5176\u4ed6\u4e00\u4e9b\u5e93\u548c\u5de5\u5177\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5c06\u6570\u636e\u5bfc\u51fa\u5230\u4e0d\u540c\u683c\u5f0f\u7684\u6587\u4ef6\u4e2d\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528<code>csv<\/code>\u5e93\u5bfc\u51fa\u6570\u636e\u5230CSV\u6587\u4ef6\uff0c\u4f7f\u7528<code>xlsxwriter<\/code>\u5e93\u5bfc\u51fa\u6570\u636e\u5230Excel\u6587\u4ef6\uff0c\u4f7f\u7528<code>json<\/code>\u5e93\u5bfc\u51fa\u6570\u636e\u5230JSON\u6587\u4ef6\u7b49\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><p>4.1\u3001\u4f7f\u7528csv\u5e93\u5bfc\u51fa\u6570\u636e\u5230CSV\u6587\u4ef6<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import csv<\/p>\n<p>import sqlite3<\/p>\n<h2><strong>\u8fde\u63a5\u5230SQLite\u6570\u636e\u5e93<\/strong><\/h2>\n<p>conn = sqlite3.connect(&#39;example.db&#39;)<\/p>\n<h2><strong>\u521b\u5efa\u6e38\u6807\u5bf9\u8c61<\/strong><\/h2>\n<p>cursor = conn.cursor()<\/p>\n<h2><strong>\u6267\u884cSQL\u67e5\u8be2<\/strong><\/h2>\n<p>cursor.execute(&#39;SELECT * FROM table_name&#39;)<\/p>\n<h2><strong>\u83b7\u53d6\u67e5\u8be2\u7ed3\u679c<\/strong><\/h2>\n<p>rows = cursor.fetchall()<\/p>\n<h2><strong>\u83b7\u53d6\u5217\u540d<\/strong><\/h2>\n<p>column_names = [description[0] for description in cursor.description]<\/p>\n<h2><strong>\u5173\u95ed\u6e38\u6807\u548c\u6570\u636e\u5e93\u8fde\u63a5<\/strong><\/h2>\n<p>cursor.close()<\/p>\n<p>conn.close()<\/p>\n<h2><strong>\u5199\u5165CSV\u6587\u4ef6<\/strong><\/h2>\n<p>with open(&#39;output.csv&#39;, &#39;w&#39;, newline=&#39;&#39;) as f:<\/p>\n<p>    writer = csv.writer(f)<\/p>\n<p>    writer.writerow(column_names)<\/p>\n<p>    writer.writerows(rows)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>4.2\u3001\u4f7f\u7528xlsxwriter\u5e93\u5bfc\u51fa\u6570\u636e\u5230Excel\u6587\u4ef6<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import xlsxwriter<\/p>\n<p>import sqlite3<\/p>\n<h2><strong>\u8fde\u63a5\u5230SQLite\u6570\u636e\u5e93<\/strong><\/h2>\n<p>conn = sqlite3.connect(&#39;example.db&#39;)<\/p>\n<h2><strong>\u521b\u5efa\u6e38\u6807\u5bf9\u8c61<\/strong><\/h2>\n<p>cursor = conn.cursor()<\/p>\n<h2><strong>\u6267\u884cSQL\u67e5\u8be2<\/strong><\/h2>\n<p>cursor.execute(&#39;SELECT * FROM table_name&#39;)<\/p>\n<h2><strong>\u83b7\u53d6\u67e5\u8be2\u7ed3\u679c<\/strong><\/h2>\n<p>rows = cursor.fetchall()<\/p>\n<h2><strong>\u83b7\u53d6\u5217\u540d<\/strong><\/h2>\n<p>column_names = [description[0] for description in cursor.description]<\/p>\n<h2><strong>\u5173\u95ed\u6e38\u6807\u548c\u6570\u636e\u5e93\u8fde\u63a5<\/strong><\/h2>\n<p>cursor.close()<\/p>\n<p>conn.close()<\/p>\n<h2><strong>\u521b\u5efaExcel\u6587\u4ef6<\/strong><\/h2>\n<p>workbook = xlsxwriter.Workbook(&#39;output.xlsx&#39;)<\/p>\n<p>worksheet = workbook.add_worksheet()<\/p>\n<h2><strong>\u5199\u5165\u5217\u540d<\/strong><\/h2>\n<p>for col_num, column_name in enumerate(column_names):<\/p>\n<p>    worksheet.write(0, col_num, column_name)<\/p>\n<h2><strong>\u5199\u5165\u6570\u636e<\/strong><\/h2>\n<p>for row_num, row in enumerate(rows, start=1):<\/p>\n<p>    for col_num, cell in enumerate(row):<\/p>\n<p>        worksheet.write(row_num, col_num, cell)<\/p>\n<h2><strong>\u5173\u95edExcel\u6587\u4ef6<\/strong><\/h2>\n<p>workbook.close()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>4.3\u3001\u4f7f\u7528json\u5e93\u5bfc\u51fa\u6570\u636e\u5230JSON\u6587\u4ef6<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import json<\/p>\n<p>import sqlite3<\/p>\n<h2><strong>\u8fde\u63a5\u5230SQLite\u6570\u636e\u5e93<\/strong><\/h2>\n<p>conn = sqlite3.connect(&#39;example.db&#39;)<\/p>\n<h2><strong>\u521b\u5efa\u6e38\u6807\u5bf9\u8c61<\/strong><\/h2>\n<p>cursor = conn.cursor()<\/p>\n<h2><strong>\u6267\u884cSQL\u67e5\u8be2<\/strong><\/h2>\n<p>cursor.execute(&#39;SELECT * FROM table_name&#39;)<\/p>\n<h2><strong>\u83b7\u53d6\u67e5\u8be2\u7ed3\u679c<\/strong><\/h2>\n<p>rows = cursor.fetchall()<\/p>\n<h2><strong>\u83b7\u53d6\u5217\u540d<\/strong><\/h2>\n<p>column_names = [description[0] for description in cursor.description]<\/p>\n<h2><strong>\u5173\u95ed\u6e38\u6807\u548c\u6570\u636e\u5e93\u8fde\u63a5<\/strong><\/h2>\n<p>cursor.close()<\/p>\n<p>conn.close()<\/p>\n<h2><strong>\u8f6c\u6362\u6570\u636e\u4e3a\u5b57\u5178\u5217\u8868<\/strong><\/h2>\n<p>data = [dict(zip(column_names, row)) for row in rows]<\/p>\n<h2><strong>\u5199\u5165JSON\u6587\u4ef6<\/strong><\/h2>\n<p>with open(&#39;output.json&#39;, &#39;w&#39;) as f:<\/p>\n<p>    json.dump(data, f)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u603b\u7ed3\uff1a<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u51e0\u79cd\u65b9\u6cd5\uff0c\u6211\u4eec\u53ef\u4ee5\u8f7b\u677e\u5730\u5c06\u6570\u636e\u5e93\u4e2d\u7684\u6570\u636e\u5bfc\u51fa\u5230\u4e0d\u540c\u683c\u5f0f\u7684\u6587\u4ef6\u4e2d\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u8fdb\u884c\u6570\u636e\u5bfc\u51fa\u64cd\u4f5c\u3002\u65e0\u8bba\u662f\u4f7f\u7528pandas\u5e93\u3001SQLAlchemy\u5e93\u8fd8\u662f\u5176\u4ed6\u5e93\uff0c\u90fd\u80fd\u6ee1\u8db3\u6570\u636e\u5bfc\u51fa\u7684\u9700\u6c42\u3002\u5e0c\u671b\u672c\u6587\u80fd\u591f\u5e2e\u52a9\u60a8\u66f4\u597d\u5730\u7406\u89e3\u5982\u4f55\u4f7f\u7528Python\u5c06\u6570\u636e\u5e93\u4e2d\u7684\u6570\u636e\u751f\u6210\u6587\u4ef6\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u4f7f\u7528Python\u5c06\u6570\u636e\u5e93\u4e2d\u7684\u6570\u636e\u5bfc\u51fa\u4e3a\u6587\u4ef6\uff1f<\/strong><br \/>\u53ef\u4ee5\u4f7f\u7528Python\u7684\u5e93\uff0c\u5982pandas\u548cSQLAlchemy\uff0c\u8fde\u63a5\u5230\u6570\u636e\u5e93\u5e76\u67e5\u8be2\u6240\u9700\u7684\u6570\u636e\u3002\u901a\u8fc7pandas\u7684<code>to_csv()<\/code>\u6216<code>to_excel()<\/code>\u7b49\u51fd\u6570\uff0c\u53ef\u4ee5\u5c06\u6570\u636e\u5bfc\u51fa\u4e3aCSV\u6216Excel\u6587\u4ef6\u3002\u8fd9\u6837\u53ef\u4ee5\u8f7b\u677e\u4fdd\u5b58\u548c\u5206\u4eab\u6570\u636e\uff0c\u4fbf\u4e8e\u540e\u7eed\u5206\u6790\u548c\u5904\u7406\u3002<\/p>\n<p><strong>Python\u652f\u6301\u5bfc\u51fa\u54ea\u4e9b\u6587\u4ef6\u683c\u5f0f\uff1f<\/strong><br \/>Python\u80fd\u591f\u751f\u6210\u591a\u79cd\u6587\u4ef6\u683c\u5f0f\uff0c\u5305\u62ecCSV\u3001Excel\u3001JSON\u3001XML\u7b49\u3002\u6839\u636e\u5177\u4f53\u9700\u6c42\uff0c\u53ef\u4ee5\u9009\u62e9\u5408\u9002\u7684\u5e93\u6765\u8fdb\u884c\u6587\u4ef6\u751f\u6210\u3002\u4f8b\u5982\uff0c\u4f7f\u7528<code>csv<\/code>\u6a21\u5757\u53ef\u4ee5\u751f\u6210CSV\u6587\u4ef6\uff0c\u800c\u4f7f\u7528<code>json<\/code>\u6a21\u5757\u5219\u53ef\u4ee5\u521b\u5efaJSON\u6587\u4ef6\u3002\u8fd9\u4e9b\u683c\u5f0f\u5e7f\u6cdb\u9002\u7528\u4e8e\u6570\u636e\u4ea4\u6362\u548c\u5b58\u50a8\u3002<\/p>\n<p><strong>\u5982\u4f55\u786e\u4fdd\u5bfc\u51fa\u7684\u6587\u4ef6\u6570\u636e\u5b8c\u6574\u6027\uff1f<\/strong><br \/>\u5728\u5bfc\u51fa\u6570\u636e\u5e93\u6570\u636e\u4e4b\u524d\uff0c\u5efa\u8bae\u8fdb\u884c\u6570\u636e\u6e05\u6d17\u548c\u9a8c\u8bc1\uff0c\u786e\u4fdd\u6570\u636e\u7684\u51c6\u786e\u6027\u3002\u53ef\u4ee5\u5728\u5bfc\u51fa\u540e\u8fdb\u884c\u6570\u636e\u6837\u672c\u68c0\u67e5\uff0c\u786e\u8ba4\u6587\u4ef6\u5185\u5bb9\u4e0e\u6570\u636e\u5e93\u4e2d\u7684\u6570\u636e\u4e00\u81f4\u3002\u6b64\u5916\uff0c\u8003\u8651\u4f7f\u7528\u4e8b\u52a1\u5904\u7406\uff0c\u4ee5\u9632\u5728\u5bfc\u51fa\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u4efb\u4f55\u9519\u8bef\uff0c\u786e\u4fdd\u6570\u636e\u4e00\u81f4\u6027\u548c\u5b8c\u6574\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u6570\u636e\u5e93\u5982\u4f55\u628apython\u751f\u6210\u6587\u4ef6 \u901a\u8fc7Python\u5c06\u6570\u636e\u751f\u6210\u6587\u4ef6\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u5b9e\u73b0\uff0c\u5305\u62ec\u4f7f\u7528pandas\u5e93\u5bfc [&hellip;]","protected":false},"author":3,"featured_media":1106024,"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\/1106014"}],"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=1106014"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1106014\/revisions"}],"predecessor-version":[{"id":1106026,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1106014\/revisions\/1106026"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1106024"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1106014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1106014"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1106014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}