{"id":1086458,"date":"2025-01-08T13:25:54","date_gmt":"2025-01-08T05:25:54","guid":{"rendered":""},"modified":"2025-01-08T13:25:56","modified_gmt":"2025-01-08T05:25:56","slug":"python%e4%b8%ad%e5%a6%82%e4%bd%95%e6%b1%82%e5%a4%a7%e5%a4%9a%e6%95%b0%e5%85%83%e7%b4%a0-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1086458.html","title":{"rendered":"python\u4e2d\u5982\u4f55\u6c42\u5927\u591a\u6570\u5143\u7d20"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24195845\/d31c307c-b7cf-4a7a-9d94-8fe1e6535789.webp\" alt=\"python\u4e2d\u5982\u4f55\u6c42\u5927\u591a\u6570\u5143\u7d20\" \/><\/p>\n<p><p> <strong>\u5728Python\u4e2d\uff0c\u6c42\u5927\u591a\u6570\u5143\u7d20\uff08\u4e5f\u79f0\u4e3a\u4f17\u6570\uff09\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\u4f7f\u7528\u5b57\u5178\u3001\u4f7f\u7528\u96c6\u5408\u3001\u4f7f\u7528Counter\u7c7b\u7b49\u3002<\/strong>\u5176\u4e2d\uff0c\u6700\u5e38\u7528\u7684\u65b9\u6cd5\u662f\u4f7f\u7528Counter\u7c7b\uff0c\u56e0\u4e3a\u5b83\u7684\u8bed\u6cd5\u7b80\u5355\u4e14\u6027\u80fd\u8f83\u597d\u3002<strong>\u901a\u8fc7Counter\u7c7b\uff0c\u6211\u4eec\u53ef\u4ee5\u8f7b\u677e\u5730\u7edf\u8ba1\u6bcf\u4e2a\u5143\u7d20\u7684\u51fa\u73b0\u6b21\u6570\uff0c\u7136\u540e\u627e\u51fa\u51fa\u73b0\u6b21\u6570\u6700\u591a\u7684\u5143\u7d20\u3002<\/strong>\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528Counter\u7c7b\u6765\u6c42\u5927\u591a\u6570\u5143\u7d20\uff0c\u5e76\u4e14\u4f1a\u4ecb\u7ecd\u5176\u4ed6\u51e0\u79cd\u65b9\u6cd5\u4f9b\u53c2\u8003\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528Counter\u7c7b<\/h3>\n<\/p>\n<p><p>Counter\u7c7b\u662fcollections\u6a21\u5757\u4e2d\u7684\u4e00\u4e2a\u7c7b\uff0c\u4e13\u95e8\u7528\u4e8e\u8ba1\u6570\u3002\u4f7f\u7528Counter\u7c7b\u6c42\u5927\u591a\u6570\u5143\u7d20\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u5bfc\u5165Counter\u7c7b\u3002<\/li>\n<li>\u521b\u5efaCounter\u5bf9\u8c61\uff0c\u5e76\u4f20\u5165\u9700\u8981\u7edf\u8ba1\u7684\u5217\u8868\u3002<\/li>\n<li>\u4f7f\u7528most_common\u65b9\u6cd5\u83b7\u53d6\u51fa\u73b0\u6b21\u6570\u6700\u591a\u7684\u5143\u7d20\u3002<\/li>\n<\/ol>\n<p><pre><code class=\"language-python\">from collections import Counter<\/p>\n<p>def majority_element(nums):<\/p>\n<p>    count = Counter(nums)<\/p>\n<p>    return count.most_common(1)[0][0]<\/p>\n<p>nums = [1, 2, 3, 2, 2, 1, 4, 2]<\/p>\n<p>print(majority_element(nums))  # Output: 2<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u8be6\u7ec6\u63cf\u8ff0\uff1a<\/strong><\/p>\n<p>Counter\u7c7b\u4f1a\u5c06\u5217\u8868\u4e2d\u7684\u6bcf\u4e2a\u5143\u7d20\u4f5c\u4e3a\u952e\uff0c\u5143\u7d20\u7684\u51fa\u73b0\u6b21\u6570\u4f5c\u4e3a\u503c\uff0c\u5b58\u50a8\u5728\u4e00\u4e2a\u5b57\u5178\u4e2d\u3002most_common\u65b9\u6cd5\u8fd4\u56de\u4e00\u4e2a\u5217\u8868\uff0c\u5217\u8868\u4e2d\u7684\u6bcf\u4e2a\u5143\u7d20\u662f\u4e00\u4e2a\u5143\u7ec4\uff0c\u5143\u7ec4\u7684\u7b2c\u4e00\u4e2a\u5143\u7d20\u662f\u5217\u8868\u4e2d\u7684\u5143\u7d20\uff0c\u7b2c\u4e8c\u4e2a\u5143\u7d20\u662f\u8be5\u5143\u7d20\u7684\u51fa\u73b0\u6b21\u6570\u3002most_common(1)\u8fd4\u56de\u51fa\u73b0\u6b21\u6570\u6700\u591a\u7684\u5143\u7d20\uff0c\u53d6\u5176\u7b2c\u4e00\u4e2a\u5143\u7d20\u5373\u53ef\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528\u5b57\u5178<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528\u5b57\u5178\u6c42\u5927\u591a\u6570\u5143\u7d20\u7684\u65b9\u6cd5\u4e0e\u4f7f\u7528Counter\u7c7b\u7684\u65b9\u6cd5\u7c7b\u4f3c\uff0c\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u521b\u5efa\u4e00\u4e2a\u7a7a\u5b57\u5178\u3002<\/li>\n<li>\u904d\u5386\u5217\u8868\uff0c\u7edf\u8ba1\u6bcf\u4e2a\u5143\u7d20\u7684\u51fa\u73b0\u6b21\u6570\uff0c\u5e76\u5b58\u5165\u5b57\u5178\u3002<\/li>\n<li>\u627e\u51fa\u5b57\u5178\u4e2d\u503c\u6700\u5927\u7684\u952e\u3002<\/li>\n<\/ol>\n<p><pre><code class=\"language-python\">def majority_element(nums):<\/p>\n<p>    count = {}<\/p>\n<p>    for num in nums:<\/p>\n<p>        if num in count:<\/p>\n<p>            count[num] += 1<\/p>\n<p>        else:<\/p>\n<p>            count[num] = 1<\/p>\n<p>    return max(count, key=count.get)<\/p>\n<p>nums = [1, 2, 3, 2, 2, 1, 4, 2]<\/p>\n<p>print(majority_element(nums))  # Output: 2<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u8be6\u7ec6\u63cf\u8ff0\uff1a<\/strong><\/p>\n<p>\u904d\u5386\u5217\u8868\u65f6\uff0c\u5982\u679c\u5143\u7d20\u5728\u5b57\u5178\u4e2d\u5df2\u7ecf\u5b58\u5728\uff0c\u5219\u5c06\u5bf9\u5e94\u7684\u503c\u52a01\uff1b\u5982\u679c\u5143\u7d20\u4e0d\u5728\u5b57\u5178\u4e2d\uff0c\u5219\u5c06\u5176\u6dfb\u52a0\u5230\u5b57\u5178\u4e2d\uff0c\u5e76\u5c06\u503c\u8bbe\u4e3a1\u3002\u6700\u540e\uff0c\u901a\u8fc7max\u51fd\u6570\u627e\u5230\u5b57\u5178\u4e2d\u503c\u6700\u5927\u7684\u952e\uff0c\u5373\u4e3a\u51fa\u73b0\u6b21\u6570\u6700\u591a\u7684\u5143\u7d20\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528\u96c6\u5408<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528\u96c6\u5408\u6c42\u5927\u591a\u6570\u5143\u7d20\u7684\u65b9\u6cd5\u8f83\u4e3a\u590d\u6742\uff0c\u56e0\u4e3a\u96c6\u5408\u672c\u8eab\u4e0d\u80fd\u5b58\u50a8\u91cd\u590d\u7684\u5143\u7d20\u3002\u6211\u4eec\u53ef\u4ee5\u5148\u5c06\u96c6\u5408\u8f6c\u6362\u4e3a\u5217\u8868\uff0c\u7136\u540e\u7edf\u8ba1\u6bcf\u4e2a\u5143\u7d20\u7684\u51fa\u73b0\u6b21\u6570\u3002\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u5c06\u5217\u8868\u8f6c\u6362\u4e3a\u96c6\u5408\uff0c\u53bb\u9664\u91cd\u590d\u5143\u7d20\u3002<\/li>\n<li>\u904d\u5386\u96c6\u5408\uff0c\u7edf\u8ba1\u6bcf\u4e2a\u5143\u7d20\u5728\u539f\u5217\u8868\u4e2d\u7684\u51fa\u73b0\u6b21\u6570\u3002<\/li>\n<li>\u627e\u51fa\u51fa\u73b0\u6b21\u6570\u6700\u591a\u7684\u5143\u7d20\u3002<\/li>\n<\/ol>\n<p><pre><code class=\"language-python\">def majority_element(nums):<\/p>\n<p>    unique_nums = set(nums)<\/p>\n<p>    max_count = 0<\/p>\n<p>    majority_element = None<\/p>\n<p>    for num in unique_nums:<\/p>\n<p>        count = nums.count(num)<\/p>\n<p>        if count &gt; max_count:<\/p>\n<p>            max_count = count<\/p>\n<p>            majority_element = num<\/p>\n<p>    return majority_element<\/p>\n<p>nums = [1, 2, 3, 2, 2, 1, 4, 2]<\/p>\n<p>print(majority_element(nums))  # Output: 2<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u8be6\u7ec6\u63cf\u8ff0\uff1a<\/strong><\/p>\n<p>\u5c06\u5217\u8868\u8f6c\u6362\u4e3a\u96c6\u5408\u540e\uff0c\u96c6\u5408\u4e2d\u7684\u6bcf\u4e2a\u5143\u7d20\u90fd\u662f\u552f\u4e00\u7684\u3002\u904d\u5386\u96c6\u5408\u65f6\uff0c\u4f7f\u7528\u5217\u8868\u7684count\u65b9\u6cd5\u7edf\u8ba1\u6bcf\u4e2a\u5143\u7d20\u5728\u539f\u5217\u8868\u4e2d\u7684\u51fa\u73b0\u6b21\u6570\u3002\u901a\u8fc7\u6bd4\u8f83\u51fa\u73b0\u6b21\u6570\uff0c\u627e\u51fa\u6700\u5927\u503c\u5bf9\u5e94\u7684\u5143\u7d20\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u4f7f\u7528\u6392\u5e8f<\/h3>\n<\/p>\n<p><p>\u4f7f\u7528\u6392\u5e8f\u6c42\u5927\u591a\u6570\u5143\u7d20\u7684\u65b9\u6cd5\u8f83\u4e3a\u7b80\u5355\uff0c\u901a\u8fc7\u6392\u5e8f\u540e\uff0c\u4f17\u6570\u4e00\u5b9a\u4f1a\u51fa\u73b0\u5728\u4e2d\u95f4\u4f4d\u7f6e\u3002\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u5c06\u5217\u8868\u8fdb\u884c\u6392\u5e8f\u3002<\/li>\n<li>\u8fd4\u56de\u6392\u5e8f\u540e\u5217\u8868\u4e2d\u95f4\u4f4d\u7f6e\u7684\u5143\u7d20\u3002<\/li>\n<\/ol>\n<p><pre><code class=\"language-python\">def majority_element(nums):<\/p>\n<p>    nums.sort()<\/p>\n<p>    return nums[len(nums) \/\/ 2]<\/p>\n<p>nums = [1, 2, 3, 2, 2, 1, 4, 2]<\/p>\n<p>print(majority_element(nums))  # Output: 2<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u8be6\u7ec6\u63cf\u8ff0\uff1a<\/strong><\/p>\n<p>\u6392\u5e8f\u540e\u7684\u5217\u8868\u4e2d\uff0c\u4f17\u6570\u4f1a\u51fa\u73b0\u5728\u4e2d\u95f4\u4f4d\u7f6e\u3002\u7531\u4e8e\u4f17\u6570\u51fa\u73b0\u6b21\u6570\u8d85\u8fc7\u4e00\u534a\uff0c\u56e0\u6b64\u6392\u5e8f\u540e\u4e2d\u95f4\u4f4d\u7f6e\u7684\u5143\u7d20\u4e00\u5b9a\u662f\u4f17\u6570\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u4f7f\u7528Boyer-Moore\u6295\u7968\u7b97\u6cd5<\/h3>\n<\/p>\n<p><p>Boyer-Moore\u6295\u7968\u7b97\u6cd5\u662f\u4e00\u4e2a\u5728\u7ebf\u6027\u65f6\u95f4\u5185\u627e\u51fa\u591a\u6570\u5143\u7d20\u7684\u7b97\u6cd5\u3002\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u521d\u59cb\u5316\u5019\u9009\u5143\u7d20\u4e3aNone\uff0c\u8ba1\u6570\u5668\u4e3a0\u3002<\/li>\n<li>\u904d\u5386\u5217\u8868\uff0c\u5982\u679c\u8ba1\u6570\u5668\u4e3a0\uff0c\u5219\u5c06\u5f53\u524d\u5143\u7d20\u8bbe\u4e3a\u5019\u9009\u5143\u7d20\uff0c\u5e76\u5c06\u8ba1\u6570\u5668\u8bbe\u4e3a1\uff1b\u5982\u679c\u5f53\u524d\u5143\u7d20\u7b49\u4e8e\u5019\u9009\u5143\u7d20\uff0c\u5219\u8ba1\u6570\u5668\u52a01\uff1b\u5426\u5219\uff0c\u8ba1\u6570\u5668\u51cf1\u3002<\/li>\n<li>\u8fd4\u56de\u5019\u9009\u5143\u7d20\u3002<\/li>\n<\/ol>\n<p><pre><code class=\"language-python\">def majority_element(nums):<\/p>\n<p>    candidate = None<\/p>\n<p>    count = 0<\/p>\n<p>    for num in nums:<\/p>\n<p>        if count == 0:<\/p>\n<p>            candidate = num<\/p>\n<p>            count = 1<\/p>\n<p>        elif num == candidate:<\/p>\n<p>            count += 1<\/p>\n<p>        else:<\/p>\n<p>            count -= 1<\/p>\n<p>    return candidate<\/p>\n<p>nums = [1, 2, 3, 2, 2, 1, 4, 2]<\/p>\n<p>print(majority_element(nums))  # Output: 2<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u8be6\u7ec6\u63cf\u8ff0\uff1a<\/strong><\/p>\n<p>Boyer-Moore\u6295\u7968\u7b97\u6cd5\u901a\u8fc7\u7ef4\u62a4\u4e00\u4e2a\u5019\u9009\u5143\u7d20\u548c\u8ba1\u6570\u5668\u6765\u786e\u5b9a\u591a\u6570\u5143\u7d20\u3002\u5f53\u8ba1\u6570\u5668\u4e3a0\u65f6\uff0c\u5c06\u5f53\u524d\u5143\u7d20\u8bbe\u4e3a\u5019\u9009\u5143\u7d20\uff0c\u5e76\u5c06\u8ba1\u6570\u5668\u8bbe\u4e3a1\uff1b\u5f53\u5f53\u524d\u5143\u7d20\u7b49\u4e8e\u5019\u9009\u5143\u7d20\u65f6\uff0c\u8ba1\u6570\u5668\u52a01\uff1b\u5426\u5219\uff0c\u8ba1\u6570\u5668\u51cf1\u3002\u6700\u7ec8\u8fd4\u56de\u5019\u9009\u5143\u7d20\uff0c\u5373\u4e3a\u591a\u6570\u5143\u7d20\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u7efc\u4e0a\u6240\u8ff0\uff0cPython\u4e2d\u6c42\u5927\u591a\u6570\u5143\u7d20\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\u4f7f\u7528Counter\u7c7b\u3001\u4f7f\u7528\u5b57\u5178\u3001\u4f7f\u7528\u96c6\u5408\u3001\u4f7f\u7528\u6392\u5e8f\u548c\u4f7f\u7528Boyer-Moore\u6295\u7968\u7b97\u6cd5\u3002<strong>\u4f7f\u7528Counter\u7c7b\u7684\u65b9\u6cd5\u6700\u4e3a\u7b80\u6d01\u9ad8\u6548\uff0c\u63a8\u8350\u4f7f\u7528\u3002<\/strong><\/p>\n<\/p>\n<ol>\n<li><strong>\u4f7f\u7528Counter\u7c7b\uff1a<\/strong> \u8bed\u6cd5\u7b80\u5355\uff0c\u6027\u80fd\u8f83\u597d\u3002<\/li>\n<li><strong>\u4f7f\u7528\u5b57\u5178\uff1a<\/strong> \u4e0eCounter\u7c7b\u7c7b\u4f3c\uff0c\u9002\u5408\u624b\u52a8\u5b9e\u73b0\u8ba1\u6570\u529f\u80fd\u3002<\/li>\n<li><strong>\u4f7f\u7528\u96c6\u5408\uff1a<\/strong> \u9002\u5408\u5728\u9700\u8981\u53bb\u91cd\u7684\u60c5\u51b5\u4e0b\u4f7f\u7528\uff0c\u6027\u80fd\u4e00\u822c\u3002<\/li>\n<li><strong>\u4f7f\u7528\u6392\u5e8f\uff1a<\/strong> \u9002\u5408\u5728\u5217\u8868\u5143\u7d20\u6570\u91cf\u8f83\u5c11\u7684\u60c5\u51b5\u4e0b\u4f7f\u7528\uff0c\u6027\u80fd\u4e00\u822c\u3002<\/li>\n<li><strong>\u4f7f\u7528Boyer-Moore\u6295\u7968\u7b97\u6cd5\uff1a<\/strong> \u9002\u5408\u5728\u9700\u8981\u5728\u7ebf\u6027\u65f6\u95f4\u5185\u627e\u51fa\u591a\u6570\u5143\u7d20\u7684\u60c5\u51b5\u4e0b\u4f7f\u7528\uff0c\u6027\u80fd\u8f83\u597d\u3002<\/li>\n<\/ol>\n<p><p>\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u6709\u6548\u5730\u6c42\u51fa\u5217\u8868\u4e2d\u7684\u591a\u6570\u5143\u7d20\u3002\u5e0c\u671b\u4ee5\u4e0a\u5185\u5bb9\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5728Python\u4e2d\uff0c\u5982\u4f55\u8bc6\u522b\u6570\u7ec4\u4e2d\u7684\u5927\u591a\u6570\u5143\u7d20\uff1f<\/strong><br \/>\u8bc6\u522b\u5927\u591a\u6570\u5143\u7d20\u53ef\u4ee5\u4f7f\u7528\u201c\u6469\u5c14\u6295\u7968\u7b97\u6cd5\u201d\uff0c\u5b83\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3aO(n)\uff0c\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3aO(1)\u3002\u8be5\u7b97\u6cd5\u901a\u8fc7\u7ef4\u62a4\u4e00\u4e2a\u5019\u9009\u5143\u7d20\u548c\u8ba1\u6570\u6765\u904d\u5386\u6570\u7ec4\uff0c\u6700\u7ec8\u786e\u5b9a\u5019\u9009\u5143\u7d20\u662f\u5426\u4e3a\u5927\u591a\u6570\u5143\u7d20\u3002\u53ef\u4ee5\u4f7f\u7528collections\u5e93\u4e2d\u7684Counter\u7c7b\u6765\u7b80\u5316\u6b64\u8fc7\u7a0b\uff0c\u5feb\u901f\u7edf\u8ba1\u5143\u7d20\u51fa\u73b0\u6b21\u6570\uff0c\u4ece\u800c\u627e\u5230\u5927\u591a\u6570\u5143\u7d20\u3002<\/p>\n<p><strong>\u5927\u591a\u6570\u5143\u7d20\u7684\u5b9a\u4e49\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>\u5927\u591a\u6570\u5143\u7d20\u6307\u7684\u662f\u5728\u6570\u7ec4\u4e2d\u51fa\u73b0\u6b21\u6570\u8d85\u8fc7\u4e00\u534a\u7684\u5143\u7d20\u3002\u4f8b\u5982\uff0c\u5728\u957f\u5ea6\u4e3an\u7684\u6570\u7ec4\u4e2d\uff0c\u5982\u679c\u67d0\u4e2a\u5143\u7d20\u51fa\u73b0\u7684\u6b21\u6570\u5927\u4e8en\/2\uff0c\u5219\u8be5\u5143\u7d20\u88ab\u8ba4\u4e3a\u662f\u5927\u591a\u6570\u5143\u7d20\u3002\u5982\u679c\u6ca1\u6709\u5143\u7d20\u6ee1\u8db3\u8fd9\u4e00\u6761\u4ef6\uff0c\u5219\u6570\u7ec4\u4e2d\u4e0d\u5b58\u5728\u5927\u591a\u6570\u5143\u7d20\u3002<\/p>\n<p><strong>\u5982\u4f55\u5904\u7406\u6ca1\u6709\u5927\u591a\u6570\u5143\u7d20\u7684\u60c5\u51b5\uff1f<\/strong><br \/>\u5728\u4f7f\u7528\u6469\u5c14\u6295\u7968\u7b97\u6cd5\u6216Counter\u7c7b\u65f6\uff0c\u5982\u679c\u6700\u7ec8\u7ed3\u679c\u7684\u8ba1\u6570\u6ca1\u6709\u8d85\u8fc7\u6570\u7ec4\u957f\u5ea6\u7684\u4e00\u534a\uff0c\u5219\u53ef\u4ee5\u8fd4\u56de\u201c\u6ca1\u6709\u5927\u591a\u6570\u5143\u7d20\u201d\u3002\u53ef\u4ee5\u901a\u8fc7\u5bf9\u6700\u7ec8\u5019\u9009\u5143\u7d20\u8fdb\u884c\u4e00\u6b21\u8ba1\u6570\u6765\u9a8c\u8bc1\u5176\u662f\u5426\u771f\u7684\u662f\u5927\u591a\u6570\u5143\u7d20\uff0c\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u7ed3\u679c\u7684\u51c6\u786e\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\uff0c\u6c42\u5927\u591a\u6570\u5143\u7d20\uff08\u4e5f\u79f0\u4e3a\u4f17\u6570\uff09\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\u4f7f\u7528\u5b57\u5178\u3001\u4f7f\u7528\u96c6\u5408\u3001\u4f7f\u7528Counter\u7c7b\u7b49\u3002\u5176\u4e2d [&hellip;]","protected":false},"author":3,"featured_media":1086465,"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\/1086458"}],"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=1086458"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1086458\/revisions"}],"predecessor-version":[{"id":1086468,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1086458\/revisions\/1086468"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1086465"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1086458"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1086458"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1086458"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}