{"id":1135791,"date":"2025-01-08T21:29:04","date_gmt":"2025-01-08T13:29:04","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1135791.html"},"modified":"2025-01-08T21:29:07","modified_gmt":"2025-01-08T13:29:07","slug":"%e5%a6%82%e4%bd%95%e8%ae%a9python%e5%ad%97%e5%85%b8%e8%be%93%e5%87%ba%e5%be%aa%e7%8e%af%e5%90%8e%e7%9a%84%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1135791.html","title":{"rendered":"\u5982\u4f55\u8ba9python\u5b57\u5178\u8f93\u51fa\u5faa\u73af\u540e\u7684\u6570\u636e\u5e93"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25104337\/b2f6f3e4-2005-49bc-89bb-f1927c6a81c3.webp\" alt=\"\u5982\u4f55\u8ba9python\u5b57\u5178\u8f93\u51fa\u5faa\u73af\u540e\u7684\u6570\u636e\u5e93\" \/><\/p>\n<p><p> <strong>\u8981\u8ba9Python\u5b57\u5178\u8f93\u51fa\u5faa\u73af\u540e\u7684\u6570\u636e\u5e93\uff0c\u53ef\u4ee5\u91c7\u53d6\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u521b\u5efa\u6570\u636e\u5e93\u8fde\u63a5\u3001\u7f16\u5199SQL\u67e5\u8be2\u3001\u5c06\u67e5\u8be2\u7ed3\u679c\u5b58\u50a8\u5230\u5b57\u5178\u4e2d\u3001\u5faa\u73af\u904d\u5386\u5b57\u5178\u3001\u8f93\u51fa\u7ed3\u679c\u3002\u4ee5\u4e0b\u662f\u5177\u4f53\u7684\u5b9e\u73b0\u6b65\u9aa4\u548c\u6ce8\u610f\u4e8b\u9879\u3002<\/strong>\u672c\u6587\u5c06\u8be6\u7ec6\u89e3\u91ca\u8fd9\u4e9b\u6b65\u9aa4\uff0c\u5e76\u63d0\u4f9b\u5b9e\u9645\u4ee3\u7801\u793a\u4f8b\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u521b\u5efa\u6570\u636e\u5e93\u8fde\u63a5<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u521b\u5efa\u4e0e\u6570\u636e\u5e93\u7684\u8fde\u63a5\u3002\u65e0\u8bba\u4f60\u4f7f\u7528\u7684\u662fMySQL\u3001PostgreSQL\u8fd8\u662fSQLite\uff0c\u90fd\u9700\u8981\u5b89\u88c5\u76f8\u5e94\u7684Python\u5e93\uff0c\u4f8b\u5982<code>mysql-connector-python<\/code>\u3001<code>psycopg2<\/code>\u6216<code>sqlite3<\/code>\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\u4ee3\u7801\uff1a<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import mysql.connector<\/p>\n<p>def create_connection():<\/p>\n<p>    connection = mysql.connector.connect(<\/p>\n<p>        host=&#39;localhost&#39;,<\/p>\n<p>        user=&#39;yourusername&#39;,<\/p>\n<p>        password=&#39;yourpassword&#39;,<\/p>\n<p>        database=&#39;yourdatabase&#39;<\/p>\n<p>    )<\/p>\n<p>    return connection<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u7f16\u5199SQL\u67e5\u8be2<\/h3>\n<\/p>\n<p><p>\u7f16\u5199\u4e00\u4e2aSQL\u67e5\u8be2\u6765\u83b7\u53d6\u4f60\u9700\u8981\u7684\u6570\u636e\u3002\u8fd9\u4e2a\u67e5\u8be2\u53ef\u4ee5\u662f\u4e00\u4e2a\u7b80\u5355\u7684SELECT\u8bed\u53e5\uff0c\u4e5f\u53ef\u4ee5\u662f\u4e00\u4e2a\u590d\u6742\u7684JOIN\u67e5\u8be2\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u4f60\u7684\u9700\u6c42\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\u4ee3\u7801\uff1a<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">def fetch_data(connection):<\/p>\n<p>    cursor = connection.cursor(dictionary=True)<\/p>\n<p>    query = &quot;SELECT * FROM your_table&quot;<\/p>\n<p>    cursor.execute(query)<\/p>\n<p>    result = cursor.fetchall()<\/p>\n<p>    return result<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u5c06\u67e5\u8be2\u7ed3\u679c\u5b58\u50a8\u5230\u5b57\u5178\u4e2d<\/h3>\n<\/p>\n<p><p>\u5c06SQL\u67e5\u8be2\u7684\u7ed3\u679c\u5b58\u50a8\u5230\u4e00\u4e2aPython\u5b57\u5178\u4e2d\u3002\u4f7f\u7528<code>cursor<\/code>\u5bf9\u8c61\u7684<code>fetchall<\/code>\u65b9\u6cd5\u53ef\u4ee5\u5c06\u6240\u6709\u8bb0\u5f55\u83b7\u53d6\u4e3a\u5b57\u5178\u683c\u5f0f\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\u4ee3\u7801\uff1a<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">def convert_to_dict(result):<\/p>\n<p>    data_dict = {}<\/p>\n<p>    for index, row in enumerate(result):<\/p>\n<p>        data_dict[index] = row<\/p>\n<p>    return data_dict<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u5faa\u73af\u904d\u5386\u5b57\u5178<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528Python\u7684\u5faa\u73af\u7ed3\u6784\u904d\u5386\u5b57\u5178\u4e2d\u7684\u6570\u636e\uff0c\u5e76\u6839\u636e\u9700\u8981\u8fdb\u884c\u5904\u7406\u6216\u8f93\u51fa\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\u4ee3\u7801\uff1a<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">def output_data(data_dict):<\/p>\n<p>    for key, value in data_dict.items():<\/p>\n<p>        print(f&quot;Record {key}: {value}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e94\u3001\u5b8c\u6574\u4ee3\u7801\u793a\u4f8b<\/h3>\n<\/p>\n<p><p>\u5c06\u6240\u6709\u6b65\u9aa4\u6574\u5408\u5230\u4e00\u8d77\uff0c\u5f62\u6210\u4e00\u4e2a\u5b8c\u6574\u7684Python\u811a\u672c\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\u4ee3\u7801\uff1a<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import mysql.connector<\/p>\n<p>def create_connection():<\/p>\n<p>    connection = mysql.connector.connect(<\/p>\n<p>        host=&#39;localhost&#39;,<\/p>\n<p>        user=&#39;yourusername&#39;,<\/p>\n<p>        password=&#39;yourpassword&#39;,<\/p>\n<p>        database=&#39;yourdatabase&#39;<\/p>\n<p>    )<\/p>\n<p>    return connection<\/p>\n<p>def fetch_data(connection):<\/p>\n<p>    cursor = connection.cursor(dictionary=True)<\/p>\n<p>    query = &quot;SELECT * FROM your_table&quot;<\/p>\n<p>    cursor.execute(query)<\/p>\n<p>    result = cursor.fetchall()<\/p>\n<p>    return result<\/p>\n<p>def convert_to_dict(result):<\/p>\n<p>    data_dict = {}<\/p>\n<p>    for index, row in enumerate(result):<\/p>\n<p>        data_dict[index] = row<\/p>\n<p>    return data_dict<\/p>\n<p>def output_data(data_dict):<\/p>\n<p>    for key, value in data_dict.items():<\/p>\n<p>        print(f&quot;Record {key}: {value}&quot;)<\/p>\n<p>if __name__ == &quot;__m<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>n__&quot;:<\/p>\n<p>    connection = create_connection()<\/p>\n<p>    result = fetch_data(connection)<\/p>\n<p>    data_dict = convert_to_dict(result)<\/p>\n<p>    output_data(data_dict)<\/p>\n<p>    connection.close()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u516d\u3001\u6df1\u5165\u63a2\u8ba8\u4e0e\u4f18\u5316<\/h3>\n<\/p>\n<p><h4>1\u3001\u9519\u8bef\u5904\u7406<\/h4>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u9519\u8bef\u5904\u7406\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002\u53ef\u4ee5\u4f7f\u7528<code>try-except<\/code>\u5757\u6765\u6355\u83b7\u548c\u5904\u7406\u6f5c\u5728\u7684\u9519\u8bef\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">try:<\/p>\n<p>    connection = create_connection()<\/p>\n<p>    result = fetch_data(connection)<\/p>\n<p>    data_dict = convert_to_dict(result)<\/p>\n<p>    output_data(data_dict)<\/p>\n<p>except mysql.connector.Error as err:<\/p>\n<p>    print(f&quot;Error: {err}&quot;)<\/p>\n<p>finally:<\/p>\n<p>    if connection.is_connected():<\/p>\n<p>        connection.close()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u6027\u80fd\u4f18\u5316<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u6570\u636e\u91cf\u5f88\u5927\uff0c\u53ef\u4ee5\u8003\u8651\u4f7f\u7528\u5206\u9875\u6280\u672f\u6765\u5206\u6279\u83b7\u53d6\u6570\u636e\u3002\u6b64\u5916\uff0c\u4f7f\u7528\u8fde\u63a5\u6c60\u6765\u7ba1\u7406\u6570\u636e\u5e93\u8fde\u63a5\u4e5f\u662f\u4e00\u79cd\u6709\u6548\u7684\u4f18\u5316\u65b9\u5f0f\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from mysql.connector import pooling<\/p>\n<p>def create_pool():<\/p>\n<p>    pool = pooling.MySQLConnectionPool(<\/p>\n<p>        pool_name=&quot;mypool&quot;,<\/p>\n<p>        pool_size=5,<\/p>\n<p>        host=&#39;localhost&#39;,<\/p>\n<p>        user=&#39;yourusername&#39;,<\/p>\n<p>        password=&#39;yourpassword&#39;,<\/p>\n<p>        database=&#39;yourdatabase&#39;<\/p>\n<p>    )<\/p>\n<p>    return pool<\/p>\n<p>pool = create_pool()<\/p>\n<p>connection = pool.get_connection()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3\u3001\u6570\u636e\u5904\u7406\u4e0e\u5206\u6790<\/h4>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u83b7\u53d6\u6570\u636e\u540e\u53ef\u80fd\u9700\u8981\u8fdb\u884c\u5404\u79cd\u6570\u636e\u5904\u7406\u548c\u5206\u6790\u64cd\u4f5c\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528Pandas\u5e93\u6765\u8fdb\u884c\u6570\u636e\u5206\u6790\u548c\u5904\u7406\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<p>def fetch_data(connection):<\/p>\n<p>    query = &quot;SELECT * FROM your_table&quot;<\/p>\n<p>    df = pd.read_sql(query, connection)<\/p>\n<p>    return df<\/p>\n<p>df = fetch_data(connection)<\/p>\n<p>print(df.describe())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4\u3001\u4f7f\u7528ORM<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u9891\u7e41\u64cd\u4f5c\u6570\u636e\u5e93\uff0c\u53ef\u4ee5\u8003\u8651\u4f7f\u7528ORM\uff08\u5bf9\u8c61\u5173\u7cfb\u6620\u5c04\uff09\u6846\u67b6\uff0c\u5982SQLAlchemy\u6216Django ORM\uff0c\u8fd9\u5c06\u5927\u5927\u7b80\u5316\u6570\u636e\u5e93\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sqlalchemy import create_engine<\/p>\n<p>from sqlalchemy.orm import sessionmaker<\/p>\n<p>engine = create_engine(&#39;mysql+mysqlconnector:\/\/yourusername:yourpassword@localhost\/yourdatabase&#39;)<\/p>\n<p>Session = sessionmaker(bind=engine)<\/p>\n<p>session = Session()<\/p>\n<h2><strong>Define your models<\/strong><\/h2>\n<h2><strong>class YourModel(Base):<\/strong><\/h2>\n<h2><strong>    ...<\/strong><\/h2>\n<h2><strong>Query<\/strong><\/h2>\n<p>results = session.query(YourModel).all()<\/p>\n<p>for result in results:<\/p>\n<p>    print(result)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e03\u3001\u5e38\u89c1\u95ee\u9898\u4e0e\u89e3\u51b3\u65b9\u6848<\/h3>\n<\/p>\n<p><h4>1\u3001\u6570\u636e\u5e93\u8fde\u63a5\u5931\u8d25<\/h4>\n<\/p>\n<p><p>\u68c0\u67e5\u6570\u636e\u5e93\u8fde\u63a5\u53c2\u6570\uff0c\u5982\u4e3b\u673a\u540d\u3001\u7528\u6237\u540d\u3001\u5bc6\u7801\u548c\u6570\u636e\u5e93\u540d\u662f\u5426\u6b63\u786e\u3002\u786e\u4fdd\u6570\u636e\u5e93\u670d\u52a1\u6b63\u5728\u8fd0\u884c\uff0c\u5e76\u4e14\u6ca1\u6709\u9632\u706b\u5899\u963b\u6b62\u8fde\u63a5\u3002<\/p>\n<\/p>\n<p><h4>2\u3001\u67e5\u8be2\u7ed3\u679c\u4e3a\u7a7a<\/h4>\n<\/p>\n<p><p>\u786e\u4fddSQL\u67e5\u8be2\u8bed\u53e5\u6b63\u786e\uff0c\u5e76\u4e14\u6570\u636e\u5e93\u8868\u4e2d\u6709\u6570\u636e\u3002\u53ef\u4ee5\u4f7f\u7528\u6570\u636e\u5e93\u7ba1\u7406\u5de5\u5177\uff08\u5982phpMyAdmin\u6216pgAdmin\uff09\u624b\u52a8\u6267\u884c\u67e5\u8be2\u8bed\u53e5\uff0c\u9a8c\u8bc1\u67e5\u8be2\u7ed3\u679c\u3002<\/p>\n<\/p>\n<p><h4>3\u3001\u6570\u636e\u91cf\u8fc7\u5927\u5bfc\u81f4\u5185\u5b58\u4e0d\u8db3<\/h4>\n<\/p>\n<p><p>\u5bf9\u4e8e\u5927\u6570\u636e\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528\u5206\u9875\u6280\u672f\u5206\u6279\u83b7\u53d6\u6570\u636e\uff0c\u6216\u8005\u4f7f\u7528\u6d41\u5f0f\u5904\u7406\uff08\u4f8b\u5982\uff0c\u4f7f\u7528\u6e38\u6807\uff09\u3002<\/p>\n<\/p>\n<p><h4>4\u3001\u6570\u636e\u7c7b\u578b\u4e0d\u5339\u914d<\/h4>\n<\/p>\n<p><p>\u786e\u4fdd\u6570\u636e\u5e93\u8868\u4e2d\u5b57\u6bb5\u7684\u6570\u636e\u7c7b\u578b\u4e0ePython\u53d8\u91cf\u7684\u6570\u636e\u7c7b\u578b\u4e00\u81f4\u3002\u4f8b\u5982\uff0c\u65e5\u671f\u548c\u65f6\u95f4\u5b57\u6bb5\u9700\u8981\u8f6c\u6362\u4e3aPython\u7684<code>datetime<\/code>\u5bf9\u8c61\u3002<\/p>\n<\/p>\n<p><h3>\u516b\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u901a\u8fc7\u672c\u6587\u7684\u4ecb\u7ecd\uff0c\u6211\u4eec\u8be6\u7ec6\u8bb2\u89e3\u4e86\u5982\u4f55\u8ba9Python\u5b57\u5178\u8f93\u51fa\u5faa\u73af\u540e\u7684\u6570\u636e\u5e93\u6570\u636e\u3002<strong>\u4e3b\u8981\u6b65\u9aa4\u5305\u62ec\u521b\u5efa\u6570\u636e\u5e93\u8fde\u63a5\u3001\u7f16\u5199SQL\u67e5\u8be2\u3001\u5c06\u67e5\u8be2\u7ed3\u679c\u5b58\u50a8\u5230\u5b57\u5178\u4e2d\u3001\u5faa\u73af\u904d\u5386\u5b57\u5178\u5e76\u8f93\u51fa\u7ed3\u679c\u3002<\/strong>\u6b64\u5916\uff0c\u6211\u4eec\u8fd8\u63a2\u8ba8\u4e86\u9519\u8bef\u5904\u7406\u3001\u6027\u80fd\u4f18\u5316\u3001\u6570\u636e\u5904\u7406\u4e0e\u5206\u6790\u4ee5\u53ca\u4f7f\u7528ORM\u7b49\u9ad8\u7ea7\u8bdd\u9898\u3002<\/p>\n<\/p>\n<p><p>\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u80fd\u5e2e\u52a9\u4f60\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\u66f4\u597d\u5730\u64cd\u4f5c\u548c\u5904\u7406\u6570\u636e\u5e93\u6570\u636e\u3002\u5982\u679c\u6709\u4efb\u4f55\u95ee\u9898\u6216\u5efa\u8bae\uff0c\u6b22\u8fce\u5728\u8bc4\u8bba\u533a\u7559\u8a00\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u5c06\u5b57\u5178\u6570\u636e\u5b58\u50a8\u5230\u6570\u636e\u5e93\u4e2d\uff1f<\/strong><br \/>\u8981\u5c06Python\u5b57\u5178\u5b58\u50a8\u5230\u6570\u636e\u5e93\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528SQLite\u3001MySQL\u6216PostgreSQL\u7b49\u6570\u636e\u5e93\u3002\u9996\u5148\uff0c\u60a8\u9700\u8981\u5b89\u88c5\u76f8\u5e94\u7684\u6570\u636e\u5e93\u9a71\u52a8\u7a0b\u5e8f\u3002\u7136\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u8fde\u63a5\u6570\u636e\u5e93\u3001\u521b\u5efa\u8868\u683c\u4ee5\u53ca\u6267\u884c\u63d2\u5165\u64cd\u4f5c\uff0c\u5c06\u5b57\u5178\u7684\u6570\u636e\u5199\u5165\u6570\u636e\u5e93\u3002\u4f8b\u5982\uff0c\u4f7f\u7528SQLite\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7<code>sqlite3<\/code>\u6a21\u5757\u8fde\u63a5\u6570\u636e\u5e93\uff0c\u521b\u5efa\u8868\u683c\uff0c\u5e76\u4f7f\u7528<code>INSERT INTO<\/code>\u8bed\u53e5\u5c06\u5b57\u5178\u6570\u636e\u63d2\u5165\u3002<\/p>\n<p><strong>\u5728\u5faa\u73af\u4e2d\u5904\u7406\u5b57\u5178\u65f6\uff0c\u5982\u4f55\u786e\u4fdd\u6570\u636e\u7684\u6b63\u786e\u6027\uff1f<\/strong><br \/>\u5904\u7406\u5b57\u5178\u65f6\uff0c\u786e\u4fdd\u6570\u636e\u51c6\u786e\u6027\u7684\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528\u5f02\u5e38\u5904\u7406\u673a\u5236\u6765\u6355\u6349\u53ef\u80fd\u7684\u9519\u8bef\u3002\u5728\u5faa\u73af\u904d\u5386\u5b57\u5178\u7684\u540c\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u6761\u4ef6\u8bed\u53e5\u68c0\u67e5\u6bcf\u4e2a\u6761\u76ee\u7684\u6709\u6548\u6027\uff0c\u907f\u514d\u5c06\u65e0\u6548\u6570\u636e\u63d2\u5165\u6570\u636e\u5e93\u3002\u6b64\u5916\uff0c\u5efa\u8bae\u5728\u63d2\u5165\u6570\u636e\u524d\u8fdb\u884c\u6570\u636e\u6e05\u6d17\uff0c\u4ee5\u786e\u4fdd\u6240\u6709\u5b57\u6bb5\u90fd\u7b26\u5408\u6570\u636e\u5e93\u7684\u7ea6\u675f\u6761\u4ef6\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Python\u4e2d\u8bfb\u53d6\u6570\u636e\u5e93\u5e76\u8f6c\u6362\u4e3a\u5b57\u5178\u683c\u5f0f\uff1f<\/strong><br \/>\u53ef\u4ee5\u901a\u8fc7\u6570\u636e\u5e93\u7684\u67e5\u8be2\u8bed\u53e5\u5c06\u6570\u636e\u8bfb\u53d6\u5230Python\u4e2d\uff0c\u7136\u540e\u4f7f\u7528<code>fetchall()<\/code>\u6216<code>fetchone()<\/code>\u65b9\u6cd5\u83b7\u53d6\u7ed3\u679c\u3002\u5c06\u83b7\u53d6\u5230\u7684\u7ed3\u679c\u8f6c\u6362\u4e3a\u5b57\u5178\u683c\u5f0f\uff0c\u53ef\u4ee5\u4f7f\u7528\u5217\u8868\u63a8\u5bfc\u5f0f\u7ed3\u5408<code>zip()<\/code>\u51fd\u6570\u3002\u8fd9\u6837\u53ef\u4ee5\u5c06\u6570\u636e\u5e93\u4e2d\u7684\u884c\u8f6c\u6362\u4e3a\u5b57\u5178\uff0c\u6bcf\u4e2a\u5b57\u6bb5\u540d\u79f0\u5bf9\u5e94\u5b57\u5178\u7684\u952e\u503c\uff0c\u65b9\u4fbf\u540e\u7eed\u5904\u7406\u548c\u4f7f\u7528\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u8ba9Python\u5b57\u5178\u8f93\u51fa\u5faa\u73af\u540e\u7684\u6570\u636e\u5e93\uff0c\u53ef\u4ee5\u91c7\u53d6\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u521b\u5efa\u6570\u636e\u5e93\u8fde\u63a5\u3001\u7f16\u5199SQL\u67e5\u8be2\u3001\u5c06\u67e5\u8be2\u7ed3\u679c\u5b58\u50a8\u5230\u5b57\u5178 [&hellip;]","protected":false},"author":3,"featured_media":1135796,"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\/1135791"}],"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=1135791"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1135791\/revisions"}],"predecessor-version":[{"id":1135797,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1135791\/revisions\/1135797"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1135796"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1135791"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1135791"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1135791"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}