{"id":1150456,"date":"2025-01-13T17:01:45","date_gmt":"2025-01-13T09:01:45","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1150456.html"},"modified":"2025-01-13T17:01:48","modified_gmt":"2025-01-13T09:01:48","slug":"python%e5%a6%82%e4%bd%95%e9%80%89%e6%8b%a9%e8%be%93%e5%87%ba%e8%a1%8c","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1150456.html","title":{"rendered":"python\u5982\u4f55\u9009\u62e9\u8f93\u51fa\u884c"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25180927\/067e6d04-643a-426f-9ddd-dd5423609c44.webp\" alt=\"python\u5982\u4f55\u9009\u62e9\u8f93\u51fa\u884c\" \/><\/p>\n<p><p> \u5728Python\u4e2d\u9009\u62e9\u8f93\u51fa\u884c\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u5b9e\u73b0\uff0c\u5305\u62ec\u6761\u4ef6\u5224\u65ad\u3001\u5217\u8868\u5207\u7247\u3001\u5faa\u73af\u548c\u751f\u6210\u5668\u7b49\u65b9\u6cd5\u3002<strong>\u5e38\u89c1\u7684\u65b9\u5f0f\u5305\u62ec\u4f7f\u7528\u6761\u4ef6\u5224\u65ad\u3001\u4f7f\u7528\u5217\u8868\u5207\u7247\u3001\u4f7f\u7528\u5faa\u73af\u3001\u4f7f\u7528\u751f\u6210\u5668<\/strong>\u3002\u5176\u4e2d\uff0c\u4f7f\u7528\u6761\u4ef6\u5224\u65ad\u662f\u8f83\u4e3a\u5e38\u89c1\u7684\u65b9\u5f0f\u4e4b\u4e00\u3002\u901a\u8fc7\u6761\u4ef6\u5224\u65ad\uff0c\u53ef\u4ee5\u7b5b\u9009\u51fa\u7b26\u5408\u7279\u5b9a\u6761\u4ef6\u7684\u884c\u5e76\u8f93\u51fa\u3002\u4f8b\u5982\uff0c\u82e5\u8981\u8f93\u51fa\u4e00\u4e2a\u5217\u8868\u4e2d\u6240\u6709\u5927\u4e8e\u67d0\u4e2a\u503c\u7684\u5143\u7d20\uff0c\u53ef\u4ee5\u4f7f\u7528\u5217\u8868\u89e3\u6790\u548c\u6761\u4ef6\u5224\u65ad\u6765\u5b9e\u73b0\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]<\/p>\n<p>selected_numbers = [num for num in numbers if num &gt; 5]<\/p>\n<p>print(selected_numbers)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u9762\u7684\u4ee3\u7801\u4f1a\u8f93\u51fa <code>[6, 7, 8, 9, 10]<\/code>\uff0c\u56e0\u4e3a\u8fd9\u4e9b\u6570\u5b57\u5927\u4e8e5\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u8be6\u7ec6\u63a2\u8ba8Python\u4e2d\u9009\u62e9\u8f93\u51fa\u884c\u7684\u5404\u79cd\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><h2>\u4e00\u3001\u6761\u4ef6\u5224\u65ad<\/h2>\n<\/p>\n<p><h3>\u57fa\u672c\u6761\u4ef6\u5224\u65ad<\/h3>\n<\/p>\n<p><p>\u6761\u4ef6\u5224\u65ad\u662f\u9009\u62e9\u8f93\u51fa\u884c\u6700\u5e38\u89c1\u7684\u65b9\u6cd5\u4e4b\u4e00\u3002\u901a\u8fc7\u4f7f\u7528<code>if<\/code>\u8bed\u53e5\uff0c\u53ef\u4ee5\u6839\u636e\u7279\u5b9a\u7684\u6761\u4ef6\u7b5b\u9009\u51fa\u9700\u8981\u8f93\u51fa\u7684\u884c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data = [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;, &quot;date&quot;, &quot;elderberry&quot;]<\/p>\n<p>for fruit in data:<\/p>\n<p>    if &quot;a&quot; in fruit:<\/p>\n<p>        print(fruit)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u904d\u5386\u4e86\u5217\u8868\u4e2d\u7684\u6bcf\u4e2a\u5143\u7d20\uff0c\u5e76\u4f7f\u7528<code>if<\/code>\u8bed\u53e5\u68c0\u67e5\u6bcf\u4e2a\u5143\u7d20\u662f\u5426\u5305\u542b\u5b57\u6bcd<code>a<\/code>\u3002\u5982\u679c\u6761\u4ef6\u4e3a\u771f\uff0c\u5219\u8f93\u51fa\u8be5\u5143\u7d20\u3002\u7ed3\u679c\u4f1a\u662f\uff1a<\/p>\n<\/p>\n<p><pre><code>apple<\/p>\n<p>banana<\/p>\n<p>date<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u590d\u6742\u6761\u4ef6\u5224\u65ad<\/h3>\n<\/p>\n<p><p>\u6709\u65f6\uff0c\u6211\u4eec\u53ef\u80fd\u9700\u8981\u4f7f\u7528\u66f4\u590d\u6742\u7684\u6761\u4ef6\u6765\u7b5b\u9009\u8f93\u51fa\u884c\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528\u5e03\u5c14\u8fd0\u7b97\u7b26\uff08\u5982<code>and<\/code>\u3001<code>or<\/code>\u548c<code>not<\/code>\uff09\u6765\u7ec4\u5408\u591a\u4e2a\u6761\u4ef6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data = [(&quot;apple&quot;, 10), (&quot;banana&quot;, 5), (&quot;cherry&quot;, 20), (&quot;date&quot;, 7), (&quot;elderberry&quot;, 15)]<\/p>\n<p>for fruit, quantity in data:<\/p>\n<p>    if &quot;e&quot; in fruit and quantity &gt; 10:<\/p>\n<p>        print(fruit, quantity)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u8ff0\u4ee3\u7801\u4f1a\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code>cherry 20<\/p>\n<p>elderberry 15<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u56e0\u4e3a\u53ea\u6709\u8fd9\u4e9b\u884c\u540c\u65f6\u6ee1\u8db3\u5305\u542b\u5b57\u6bcd<code>e<\/code>\u4e14\u6570\u91cf\u5927\u4e8e10\u7684\u6761\u4ef6\u3002<\/p>\n<\/p>\n<p><h2>\u4e8c\u3001\u5217\u8868\u5207\u7247<\/h2>\n<\/p>\n<p><p>\u5217\u8868\u5207\u7247\u662f\u4e00\u79cd\u5f3a\u5927\u7684\u5de5\u5177\uff0c\u5141\u8bb8\u6211\u4eec\u6839\u636e\u7d22\u5f15\u8303\u56f4\u6765\u9009\u62e9\u8f93\u51fa\u884c\u3002\u5217\u8868\u5207\u7247\u8bed\u6cd5\u5982\u4e0b\uff1a<code>list[start:end:step]<\/code>\u3002<\/p>\n<\/p>\n<p><h3>\u57fa\u672c\u5217\u8868\u5207\u7247<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528\u5217\u8868\u5207\u7247\u53ef\u4ee5\u8f7b\u677e\u5730\u9009\u62e9\u7279\u5b9a\u8303\u56f4\u7684\u5143\u7d20\u3002\u4f8b\u5982\uff0c\u6211\u4eec\u53ef\u4ee5\u9009\u62e9\u4e00\u4e2a\u5217\u8868\u4e2d\u7684\u524d3\u4e2a\u5143\u7d20\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data = [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;, &quot;date&quot;, &quot;elderberry&quot;]<\/p>\n<p>selected_data = data[:3]<\/p>\n<p>print(selected_data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<\/p>\n<p><pre><code>[&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u5e26\u6b65\u957f\u7684\u5217\u8868\u5207\u7247<\/h3>\n<\/p>\n<p><p>\u6211\u4eec\u8fd8\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a\u6b65\u957f\u6765\u9009\u62e9\u8f93\u51fa\u884c\u3002\u4f8b\u5982\uff0c\u9009\u62e9\u5217\u8868\u4e2d\u7684\u6bcf\u9694\u4e00\u4e2a\u5143\u7d20\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data = [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;, &quot;date&quot;, &quot;elderberry&quot;]<\/p>\n<p>selected_data = data[::2]<\/p>\n<p>print(selected_data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<\/p>\n<p><pre><code>[&#39;apple&#39;, &#39;cherry&#39;, &#39;elderberry&#39;]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u4e09\u3001\u5faa\u73af<\/h2>\n<\/p>\n<p><p>\u5faa\u73af\u662f\u53e6\u4e00\u79cd\u9009\u62e9\u8f93\u51fa\u884c\u7684\u5e38\u7528\u65b9\u6cd5\uff0c\u5c24\u5176\u662f\u5728\u5904\u7406\u5927\u578b\u6570\u636e\u96c6\u65f6\u3002\u901a\u8fc7\u5faa\u73af\uff0c\u53ef\u4ee5\u904d\u5386\u6570\u636e\u96c6\u4e2d\u7684\u6bcf\u4e00\u884c\uff0c\u5e76\u6839\u636e\u7279\u5b9a\u6761\u4ef6\u9009\u62e9\u9700\u8981\u8f93\u51fa\u7684\u884c\u3002<\/p>\n<\/p>\n<p><h3>\u57fa\u672c\u5faa\u73af<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528<code>for<\/code>\u5faa\u73af\u904d\u5386\u5217\u8868\uff0c\u5e76\u6839\u636e\u6761\u4ef6\u9009\u62e9\u8f93\u51fa\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]<\/p>\n<p>for num in data:<\/p>\n<p>    if num % 2 == 0:<\/p>\n<p>        print(num)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u8ff0\u4ee3\u7801\u4f1a\u8f93\u51fa\u6240\u6709\u5076\u6570\uff1a<\/p>\n<\/p>\n<p><pre><code>2<\/p>\n<p>4<\/p>\n<p>6<\/p>\n<p>8<\/p>\n<p>10<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u5d4c\u5957\u5faa\u73af<\/h3>\n<\/p>\n<p><p>\u5728\u5904\u7406\u4e8c\u7ef4\u6570\u636e\uff08\u5982\u5217\u8868\u7684\u5217\u8868\uff09\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u5d4c\u5957\u5faa\u73af\u6765\u9009\u62e9\u8f93\u51fa\u884c\u3002\u4f8b\u5982\uff0c\u9009\u62e9\u4e00\u4e2a\u4e8c\u7ef4\u5217\u8868\u4e2d\u6240\u6709\u5927\u4e8e5\u7684\u5143\u7d20\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data = [<\/p>\n<p>    [1, 2, 3],<\/p>\n<p>    [4, 5, 6],<\/p>\n<p>    [7, 8, 9]<\/p>\n<p>]<\/p>\n<p>for row in data:<\/p>\n<p>    for num in row:<\/p>\n<p>        if num &gt; 5:<\/p>\n<p>            print(num)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<\/p>\n<p><pre><code>6<\/p>\n<p>7<\/p>\n<p>8<\/p>\n<p>9<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u56db\u3001\u751f\u6210\u5668<\/h2>\n<\/p>\n<p><p>\u751f\u6210\u5668\u662f\u4e00\u79cd\u9ad8\u6548\u7684\u9009\u62e9\u8f93\u51fa\u884c\u7684\u65b9\u6cd5\uff0c\u7279\u522b\u9002\u7528\u4e8e\u5904\u7406\u5927\u578b\u6570\u636e\u96c6\u3002\u751f\u6210\u5668\u4e0d\u4f1a\u4e00\u6b21\u6027\u5c06\u6240\u6709\u6570\u636e\u52a0\u8f7d\u5230\u5185\u5b58\u4e2d\uff0c\u800c\u662f\u6309\u9700\u751f\u6210\u6570\u636e\uff0c\u8fd9\u4f7f\u5f97\u5b83\u975e\u5e38\u9002\u5408\u5904\u7406\u5185\u5b58\u654f\u611f\u7684\u4efb\u52a1\u3002<\/p>\n<\/p>\n<p><h3>\u57fa\u672c\u751f\u6210\u5668<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528\u751f\u6210\u5668\u8868\u8fbe\u5f0f\u53ef\u4ee5\u8f7b\u677e\u5730\u9009\u62e9\u8f93\u51fa\u884c\u3002\u4f8b\u5982\uff0c\u9009\u62e9\u4e00\u4e2a\u5217\u8868\u4e2d\u6240\u6709\u5927\u4e8e5\u7684\u5143\u7d20\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]<\/p>\n<p>selected_data = (num for num in data if num &gt; 5)<\/p>\n<p>for num in selected_data:<\/p>\n<p>    print(num)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u8ff0\u4ee3\u7801\u4f1a\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code>6<\/p>\n<p>7<\/p>\n<p>8<\/p>\n<p>9<\/p>\n<p>10<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u751f\u6210\u5668\u51fd\u6570<\/h3>\n<\/p>\n<p><p>\u6211\u4eec\u8fd8\u53ef\u4ee5\u5b9a\u4e49\u751f\u6210\u5668\u51fd\u6570\u6765\u9009\u62e9\u8f93\u51fa\u884c\u3002\u751f\u6210\u5668\u51fd\u6570\u4f7f\u7528<code>yield<\/code>\u8bed\u53e5\u9010\u4e00\u751f\u6210\u6570\u636e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def select_greater_than_five(data):<\/p>\n<p>    for num in data:<\/p>\n<p>        if num &gt; 5:<\/p>\n<p>            yield num<\/p>\n<p>data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]<\/p>\n<p>selected_data = select_greater_than_five(data)<\/p>\n<p>for num in selected_data:<\/p>\n<p>    print(num)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\u7ed3\u679c\u4e0e\u524d\u4e00\u4e2a\u4f8b\u5b50\u76f8\u540c\uff1a<\/p>\n<\/p>\n<p><pre><code>6<\/p>\n<p>7<\/p>\n<p>8<\/p>\n<p>9<\/p>\n<p>10<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u4e94\u3001Pandas\u5e93<\/h2>\n<\/p>\n<p><p>Pandas\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u6570\u636e\u5206\u6790\u5e93\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u6570\u636e\u9009\u62e9\u548c\u8fc7\u6ee4\u529f\u80fd\u3002\u4f7f\u7528Pandas\u5e93\uff0c\u53ef\u4ee5\u8f7b\u677e\u5730\u9009\u62e9\u8f93\u51fa\u884c\u3002<\/p>\n<\/p>\n<p><h3>\u57fa\u672c\u9009\u62e9<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528Pandas\u5e93\u53ef\u4ee5\u8f7b\u677e\u5730\u4ece\u6570\u636e\u6846\u4e2d\u9009\u62e9\u7b26\u5408\u7279\u5b9a\u6761\u4ef6\u7684\u884c\u3002\u4f8b\u5982\uff0c\u9009\u62e9\u4e00\u4e2a\u6570\u636e\u6846\u4e2d\u6240\u6709\u5927\u4e8e5\u7684\u5143\u7d20\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<p>data = {<\/p>\n<p>    &quot;A&quot;: [1, 2, 3, 4, 5],<\/p>\n<p>    &quot;B&quot;: [6, 7, 8, 9, 10]<\/p>\n<p>}<\/p>\n<p>df = pd.DataFrame(data)<\/p>\n<p>selected_df = df[df[&quot;B&quot;] &gt; 5]<\/p>\n<p>print(selected_df)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<\/p>\n<p><pre><code>   A   B<\/p>\n<p>0  1   6<\/p>\n<p>1  2   7<\/p>\n<p>2  3   8<\/p>\n<p>3  4   9<\/p>\n<p>4  5  10<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u590d\u6742\u9009\u62e9<\/h3>\n<\/p>\n<p><p>Pandas\u8fd8\u652f\u6301\u590d\u6742\u7684\u9009\u62e9\u6761\u4ef6\u3002\u4f8b\u5982\uff0c\u9009\u62e9\u6570\u636e\u6846\u4e2d\u5217A\u5927\u4e8e2\u4e14\u5217B\u5c0f\u4e8e9\u7684\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">selected_df = df[(df[&quot;A&quot;] &gt; 2) &amp; (df[&quot;B&quot;] &lt; 9)]<\/p>\n<p>print(selected_df)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<\/p>\n<p><pre><code>   A  B<\/p>\n<p>2  3  8<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u516d\u3001\u6b63\u5219\u8868\u8fbe\u5f0f<\/h2>\n<\/p>\n<p><p>\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u53ef\u4ee5\u57fa\u4e8e\u6a21\u5f0f\u5339\u914d\u9009\u62e9\u8f93\u51fa\u884c\u3002Python\u7684<code>re<\/code>\u6a21\u5757\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><h3>\u57fa\u672c\u6b63\u5219\u8868\u8fbe\u5f0f<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u9009\u62e9\u5305\u542b\u7279\u5b9a\u6a21\u5f0f\u7684\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<p>data = [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;, &quot;date&quot;, &quot;elderberry&quot;]<\/p>\n<p>pattern = re.compile(r&quot;e&quot;)<\/p>\n<p>for fruit in data:<\/p>\n<p>    if pattern.search(fruit):<\/p>\n<p>        print(fruit)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<\/p>\n<p><pre><code>cherry<\/p>\n<p>date<\/p>\n<p>elderberry<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u590d\u6742\u6b63\u5219\u8868\u8fbe\u5f0f<\/h3>\n<\/p>\n<p><p>\u6b63\u5219\u8868\u8fbe\u5f0f\u8fd8\u652f\u6301\u66f4\u590d\u6742\u7684\u6a21\u5f0f\u5339\u914d\u3002\u4f8b\u5982\uff0c\u9009\u62e9\u4ee5\u5143\u97f3\u5f00\u5934\u7684\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">pattern = re.compile(r&quot;^[aeiou]&quot;)<\/p>\n<p>for fruit in data:<\/p>\n<p>    if pattern.match(fruit):<\/p>\n<p>        print(fruit)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<\/p>\n<p><pre><code>apple<\/p>\n<p>elderberry<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u4e03\u3001\u96c6\u5408\u64cd\u4f5c<\/h2>\n<\/p>\n<p><p>\u96c6\u5408\u64cd\u4f5c\u63d0\u4f9b\u4e86\u4e00\u79cd\u9ad8\u6548\u7684\u9009\u62e9\u8f93\u51fa\u884c\u7684\u65b9\u6cd5\uff0c\u7279\u522b\u9002\u7528\u4e8e\u9700\u8981\u53bb\u91cd\u548c\u4ea4\u96c6\u64cd\u4f5c\u7684\u573a\u666f\u3002<\/p>\n<\/p>\n<p><h3>\u57fa\u672c\u96c6\u5408\u64cd\u4f5c<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528\u96c6\u5408\u64cd\u4f5c\u53ef\u4ee5\u8f7b\u677e\u5730\u9009\u62e9\u8f93\u51fa\u884c\u3002\u4f8b\u5982\uff0c\u9009\u62e9\u4e24\u4e2a\u5217\u8868\u7684\u4ea4\u96c6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">list1 = [1, 2, 3, 4, 5]<\/p>\n<p>list2 = [4, 5, 6, 7, 8]<\/p>\n<p>intersection = set(list1) &amp; set(list2)<\/p>\n<p>print(list(intersection))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<\/p>\n<p><pre><code>[4, 5]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u590d\u6742\u96c6\u5408\u64cd\u4f5c<\/h3>\n<\/p>\n<p><p>\u96c6\u5408\u64cd\u4f5c\u8fd8\u652f\u6301\u66f4\u591a\u7684\u64cd\u4f5c\uff0c\u4f8b\u5982\u5e76\u96c6\u3001\u5dee\u96c6\u548c\u5bf9\u79f0\u5dee\u96c6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">union = set(list1) | set(list2)<\/p>\n<p>difference = set(list1) - set(list2)<\/p>\n<p>symmetric_difference = set(list1) ^ set(list2)<\/p>\n<p>print(&quot;Union:&quot;, list(union))<\/p>\n<p>print(&quot;Difference:&quot;, list(difference))<\/p>\n<p>print(&quot;Symmetric Difference:&quot;, list(symmetric_difference))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<\/p>\n<p><pre><code>Union: [1, 2, 3, 4, 5, 6, 7, 8]<\/p>\n<p>Difference: [1, 2, 3]<\/p>\n<p>Symmetric Difference: [1, 2, 3, 6, 7, 8]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u516b\u3001\u5b57\u5178\u64cd\u4f5c<\/h2>\n<\/p>\n<p><p>\u5b57\u5178\u64cd\u4f5c\u63d0\u4f9b\u4e86\u4e00\u79cd\u57fa\u4e8e\u952e\u503c\u5bf9\u9009\u62e9\u8f93\u51fa\u884c\u7684\u65b9\u6cd5\uff0c\u7279\u522b\u9002\u7528\u4e8e\u5904\u7406\u7ed3\u6784\u5316\u6570\u636e\u3002<\/p>\n<\/p>\n<p><h3>\u57fa\u672c\u5b57\u5178\u64cd\u4f5c<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528\u5b57\u5178\u64cd\u4f5c\u53ef\u4ee5\u8f7b\u677e\u5730\u9009\u62e9\u8f93\u51fa\u884c\u3002\u4f8b\u5982\uff0c\u9009\u62e9\u5b57\u5178\u4e2d\u503c\u5927\u4e8e5\u7684\u952e\u503c\u5bf9\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data = {&quot;a&quot;: 1, &quot;b&quot;: 6, &quot;c&quot;: 3, &quot;d&quot;: 8, &quot;e&quot;: 2}<\/p>\n<p>selected_data = {k: v for k, v in data.items() if v &gt; 5}<\/p>\n<p>print(selected_data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<\/p>\n<p><pre><code>{&#39;b&#39;: 6, &#39;d&#39;: 8}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u590d\u6742\u5b57\u5178\u64cd\u4f5c<\/h3>\n<\/p>\n<p><p>\u5b57\u5178\u64cd\u4f5c\u8fd8\u652f\u6301\u66f4\u590d\u6742\u7684\u9009\u62e9\u6761\u4ef6\u3002\u4f8b\u5982\uff0c\u9009\u62e9\u952e\u5305\u542b\u7279\u5b9a\u5b50\u5b57\u7b26\u4e32\u7684\u952e\u503c\u5bf9\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">selected_data = {k: v for k, v in data.items() if &quot;a&quot; in k}<\/p>\n<p>print(selected_data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<\/p>\n<p><pre><code>{&#39;a&#39;: 1}<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u4e5d\u3001Numpy\u5e93<\/h2>\n<\/p>\n<p><p>Numpy\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u6570\u503c\u8ba1\u7b97\u5e93\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u6570\u7ec4\u64cd\u4f5c\u529f\u80fd\u3002\u4f7f\u7528Numpy\u5e93\uff0c\u53ef\u4ee5\u9ad8\u6548\u5730\u9009\u62e9\u8f93\u51fa\u884c\u3002<\/p>\n<\/p>\n<p><h3>\u57fa\u672c\u9009\u62e9<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528Numpy\u5e93\u53ef\u4ee5\u8f7b\u677e\u5730\u4ece\u6570\u7ec4\u4e2d\u9009\u62e9\u7b26\u5408\u7279\u5b9a\u6761\u4ef6\u7684\u5143\u7d20\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import numpy as np<\/p>\n<p>data = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])<\/p>\n<p>selected_data = data[data &gt; 5]<\/p>\n<p>print(selected_data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<\/p>\n<p><pre><code>[ 6  7  8  9 10]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u590d\u6742\u9009\u62e9<\/h3>\n<\/p>\n<p><p>Numpy\u8fd8\u652f\u6301\u590d\u6742\u7684\u9009\u62e9\u6761\u4ef6\u3002\u4f8b\u5982\uff0c\u9009\u62e9\u4e8c\u7ef4\u6570\u7ec4\u4e2d\u6240\u6709\u5927\u4e8e5\u7684\u5143\u7d20\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data = np.array([<\/p>\n<p>    [1, 2, 3],<\/p>\n<p>    [4, 5, 6],<\/p>\n<p>    [7, 8, 9]<\/p>\n<p>])<\/p>\n<p>selected_data = data[data &gt; 5]<\/p>\n<p>print(selected_data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<\/p>\n<p><pre><code>[6 7 8 9]<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u5341\u3001SQL\u67e5\u8be2<\/h2>\n<\/p>\n<p><p>\u5728\u5904\u7406\u5927\u578b\u6570\u636e\u96c6\u6216\u6570\u636e\u5e93\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528SQL\u67e5\u8be2\u6765\u9009\u62e9\u8f93\u51fa\u884c\u3002Python\u4e2d\u7684<code>sqlite3<\/code>\u6a21\u5757\u548c\u5176\u4ed6\u6570\u636e\u5e93\u8fde\u63a5\u5668\uff08\u5982<code>psycopg2<\/code>\u3001<code>mysql-connector-python<\/code>\u7b49\uff09\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u6267\u884cSQL\u67e5\u8be2\u3002<\/p>\n<\/p>\n<p><h3>\u57fa\u672cSQL\u67e5\u8be2<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528SQL\u67e5\u8be2\u9009\u62e9\u7b26\u5408\u7279\u5b9a\u6761\u4ef6\u7684\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import sqlite3<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u5185\u5b58\u6570\u636e\u5e93\u5e76\u63d2\u5165\u6570\u636e<\/strong><\/h2>\n<p>conn = sqlite3.connect(&quot;:memory:&quot;)<\/p>\n<p>c = conn.cursor()<\/p>\n<p>c.execute(&quot;CREATE TABLE fruits (name TEXT, quantity INTEGER)&quot;)<\/p>\n<p>c.executemany(&quot;INSERT INTO fruits VALUES (?, ?)&quot;, [(&quot;apple&quot;, 10), (&quot;banana&quot;, 5), (&quot;cherry&quot;, 20), (&quot;date&quot;, 7), (&quot;elderberry&quot;, 15)])<\/p>\n<h2><strong>\u6267\u884c\u67e5\u8be2<\/strong><\/h2>\n<p>c.execute(&quot;SELECT * FROM fruits WHERE quantity &gt; 10&quot;)<\/p>\n<p>rows = c.fetchall()<\/p>\n<p>for row in rows:<\/p>\n<p>    print(row)<\/p>\n<h2><strong>\u5173\u95ed\u8fde\u63a5<\/strong><\/h2>\n<p>conn.close()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<\/p>\n<p><pre><code>(&#39;cherry&#39;, 20)<\/p>\n<p>(&#39;elderberry&#39;, 15)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u590d\u6742SQL\u67e5\u8be2<\/h3>\n<\/p>\n<p><p>SQL\u67e5\u8be2\u8fd8\u652f\u6301\u590d\u6742\u7684\u9009\u62e9\u6761\u4ef6\u3002\u4f8b\u5982\uff0c\u9009\u62e9\u540d\u79f0\u5305\u542b\u5b57\u6bcd<code>e<\/code>\u7684\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">c.execute(&quot;SELECT * FROM fruits WHERE name LIKE &#39;%e%&#39;&quot;)<\/p>\n<p>rows = c.fetchall()<\/p>\n<p>for row in rows:<\/p>\n<p>    print(row)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<\/p>\n<p><pre><code>(&#39;apple&#39;, 10)<\/p>\n<p>(&#39;cherry&#39;, 20)<\/p>\n<p>(&#39;date&#39;, 7)<\/p>\n<p>(&#39;elderberry&#39;, 15)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u5341\u4e00\u3001\u7ec4\u5408\u65b9\u6cd5<\/h2>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u6211\u4eec\u5e38\u5e38\u9700\u8981\u7ec4\u5408\u591a\u79cd\u65b9\u6cd5\u6765\u9009\u62e9\u8f93\u51fa\u884c\u3002\u7ed3\u5408\u4f7f\u7528\u6761\u4ef6\u5224\u65ad\u3001\u5faa\u73af\u3001\u751f\u6210\u5668\u3001Pandas\u3001Numpy\u548cSQL\u67e5\u8be2\u7b49\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5b9e\u73b0\u590d\u6742\u7684\u6570\u636e\u9009\u62e9\u548c\u8fc7\u6ee4\u9700\u6c42\u3002<\/p>\n<\/p>\n<p><h3>\u7ec4\u5408\u6761\u4ef6\u5224\u65ad\u548c\u751f\u6210\u5668<\/h3>\n<\/p>\n<p><p>\u7ed3\u5408\u6761\u4ef6\u5224\u65ad\u548c\u751f\u6210\u5668\uff0c\u53ef\u4ee5\u5b9e\u73b0\u9ad8\u6548\u7684\u6570\u636e\u9009\u62e9\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def select_greater_than_five_with_e(data):<\/p>\n<p>    for fruit, quantity in data:<\/p>\n<p>        if quantity &gt; 5 and &quot;e&quot; in fruit:<\/p>\n<p>            yield fruit, quantity<\/p>\n<p>data = [(&quot;apple&quot;, 10), (&quot;banana&quot;, 5), (&quot;cherry&quot;, 20), (&quot;date&quot;, 7), (&quot;elderberry&quot;, 15)]<\/p>\n<p>selected_data = select_greater_than_five_with_e(data)<\/p>\n<p>for fruit, quantity in selected_data:<\/p>\n<p>    print(fruit, quantity)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<\/p>\n<p><pre><code>cherry 20<\/p>\n<p>elderberry 15<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u7ec4\u5408Pandas\u548cNumpy<\/h3>\n<\/p>\n<p><p>\u7ed3\u5408\u4f7f\u7528Pandas\u548cNumpy\uff0c\u53ef\u4ee5\u5b9e\u73b0\u9ad8\u6548\u7684\u6570\u636e\u9009\u62e9\u548c\u64cd\u4f5c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<p>import numpy as np<\/p>\n<p>data = pd.DataFrame({<\/p>\n<p>    &quot;A&quot;: [1, 2, 3, 4, 5],<\/p>\n<p>    &quot;B&quot;: [6, 7, 8, 9, 10]<\/p>\n<p>})<\/p>\n<p>selected_data = data[np.logical_and(data[&quot;A&quot;] &gt; 2, data[&quot;B&quot;] &lt; 9)]<\/p>\n<p>print(selected_data)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<\/p>\n<p><pre><code>   A  B<\/p>\n<p>2  3  8<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u7ec4\u5408SQL\u548cPandas<\/h3>\n<\/p>\n<p><p>\u7ed3\u5408\u4f7f\u7528SQL\u67e5\u8be2\u548cPandas\uff0c\u53ef\u4ee5\u5b9e\u73b0\u9ad8\u6548\u7684\u6570\u636e\u9009\u62e9\u548c\u5206\u6790\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import sqlite3<\/p>\n<p>import pandas as pd<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u5185\u5b58\u6570\u636e\u5e93\u5e76\u63d2\u5165\u6570\u636e<\/strong><\/h2>\n<p>conn = sqlite3.connect(&quot;:memory:&quot;)<\/p>\n<p>c = conn.cursor()<\/p>\n<p>c.execute(&quot;CREATE TABLE fruits (name TEXT, quantity INTEGER)&quot;)<\/p>\n<p>c.executemany(&quot;INSERT INTO fruits VALUES (?, ?)&quot;, [(&quot;apple&quot;, 10), (&quot;banana&quot;, 5), (&quot;cherry&quot;, 20), (&quot;date&quot;, 7), (&quot;elderberry&quot;, 15)])<\/p>\n<h2><strong>\u6267\u884c\u67e5\u8be2\u5e76\u5c06\u7ed3\u679c\u52a0\u8f7d\u5230Pandas\u6570\u636e\u6846<\/strong><\/h2>\n<p>query = &quot;SELECT * FROM fruits WHERE quantity &gt; 10&quot;<\/p>\n<p>df = pd.read_sql_query(query, conn)<\/p>\n<p>print(df)<\/p>\n<h2><strong>\u5173\u95ed\u8fde\u63a5<\/strong><\/h2>\n<p>conn.close()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<\/p>\n<p><pre><code>         name  quantity<\/p>\n<p>0      cherry        20<\/p>\n<p>1  elderberry        15<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u591a\u79cd\u65b9\u6cd5\u548c\u7ec4\u5408\u4f7f\u7528\uff0cPython\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u5de5\u5177\u6765\u9009\u62e9\u8f93\u51fa\u884c\u3002\u65e0\u8bba\u662f\u7b80\u5355\u7684\u6761\u4ef6\u5224\u65ad\u3001\u5217\u8868\u5207\u7247\uff0c\u8fd8\u662f\u590d\u6742\u7684\u751f\u6210\u5668\u3001Pandas\u3001Numpy\u548cSQL\u67e5\u8be2\uff0c\u90fd\u53ef\u4ee5\u6839\u636e\u4e0d\u540c\u7684\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u6765\u5b9e\u73b0\u9ad8\u6548\u7684\u6570\u636e\u9009\u62e9\u548c\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u9009\u62e9\u7279\u5b9a\u7684\u884c\u8fdb\u884c\u8f93\u51fa\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u79cd\u65b9\u6cd5\u6765\u9009\u62e9\u7279\u5b9a\u7684\u884c\u8fdb\u884c\u8f93\u51fa\u3002\u6700\u5e38\u7528\u7684\u65b9\u6cd5\u662f\u901a\u8fc7\u5217\u8868\u5207\u7247\u3001\u6761\u4ef6\u8fc7\u6ee4\u548c\u4f7f\u7528\u5e93\uff08\u5982Pandas\uff09\u6765\u5b9e\u73b0\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u7d22\u5f15\u8bbf\u95ee\u7279\u5b9a\u884c\uff0c\u6216\u8005\u4f7f\u7528\u5faa\u73af\u548c\u6761\u4ef6\u8bed\u53e5\u6765\u7b5b\u9009\u51fa\u7b26\u5408\u6761\u4ef6\u7684\u884c\u3002\u4f8b\u5982\uff0c\u4f7f\u7528<code>for<\/code>\u5faa\u73af\u7ed3\u5408<code>if<\/code>\u8bed\u53e5\uff0c\u53ef\u4ee5\u8f7b\u677e\u8f93\u51fa\u6ee1\u8db3\u7279\u5b9a\u6761\u4ef6\u7684\u884c\u3002<\/p>\n<p><strong>\u4f7f\u7528Pandas\u5e93\u9009\u62e9\u8f93\u51fa\u884c\u7684\u6700\u4f73\u5b9e\u8df5\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>Pandas\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u6570\u636e\u5904\u7406\u5e93\uff0c\u5141\u8bb8\u7528\u6237\u901a\u8fc7DataFrame\u8f7b\u677e\u9009\u62e9\u548c\u8f93\u51fa\u7279\u5b9a\u884c\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528<code>loc<\/code>\u6216<code>iloc<\/code>\u65b9\u6cd5\uff0c\u901a\u8fc7\u884c\u6807\u7b7e\u6216\u4f4d\u7f6e\u9009\u62e9\u884c\u3002\u6b64\u5916\uff0c\u7ed3\u5408\u5e03\u5c14\u7d22\u5f15\uff0c\u53ef\u4ee5\u5feb\u901f\u7b5b\u9009\u51fa\u6ee1\u8db3\u7279\u5b9a\u6761\u4ef6\u7684\u884c\uff0c\u4f8b\u5982<code>df[df[&#39;column&#39;] &gt; value]<\/code>\uff0c\u8fd9\u5c06\u8fd4\u56de\u6240\u6709\u5728\u6307\u5b9a\u5217\u4e2d\u5927\u4e8e\u67d0\u4e2a\u503c\u7684\u884c\u3002<\/p>\n<p><strong>\u5728\u5904\u7406\u5927\u6587\u4ef6\u65f6\uff0c\u5982\u4f55\u9ad8\u6548\u9009\u62e9\u548c\u8f93\u51fa\u884c\uff1f<\/strong><br \/>\u5904\u7406\u5927\u6587\u4ef6\u65f6\uff0c\u6548\u7387\u81f3\u5173\u91cd\u8981\u3002\u53ef\u4ee5\u4f7f\u7528<code>csv<\/code>\u6a21\u5757\u9010\u884c\u8bfb\u53d6\u6587\u4ef6\uff0c\u800c\u4e0d\u662f\u4e00\u6b21\u6027\u52a0\u8f7d\u6574\u4e2a\u6587\u4ef6\u3002\u901a\u8fc7\u8bbe\u7f6e\u6761\u4ef6\u8fc7\u6ee4\uff0c\u5728\u8bfb\u53d6\u7684\u540c\u65f6\u7b5b\u9009\u51fa\u6240\u9700\u7684\u884c\u3002\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u4ec5\u8282\u7701\u5185\u5b58\uff0c\u8fd8\u80fd\u63d0\u9ad8\u5904\u7406\u901f\u5ea6\u3002\u6b64\u5916\uff0c\u53ef\u4ee5\u8003\u8651\u4f7f\u7528<code>pandas<\/code>\u7684<code>read_csv<\/code>\u51fd\u6570\uff0c\u7ed3\u5408<code>chunksize<\/code>\u53c2\u6570\u5206\u6279\u8bfb\u53d6\u6570\u636e\uff0c\u7136\u540e\u5bf9\u6bcf\u4e00\u6279\u6570\u636e\u8fdb\u884c\u884c\u9009\u62e9\u548c\u8f93\u51fa\uff0c\u8fd9\u6837\u4e5f\u80fd\u6709\u6548\u7ba1\u7406\u5185\u5b58\u4f7f\u7528\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\u9009\u62e9\u8f93\u51fa\u884c\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u5f0f\u5b9e\u73b0\uff0c\u5305\u62ec\u6761\u4ef6\u5224\u65ad\u3001\u5217\u8868\u5207\u7247\u3001\u5faa\u73af\u548c\u751f\u6210\u5668\u7b49\u65b9\u6cd5\u3002\u5e38\u89c1\u7684\u65b9\u5f0f\u5305\u62ec\u4f7f\u7528 [&hellip;]","protected":false},"author":3,"featured_media":1150467,"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\/1150456"}],"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=1150456"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1150456\/revisions"}],"predecessor-version":[{"id":1150469,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1150456\/revisions\/1150469"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1150467"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1150456"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1150456"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1150456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}