{"id":1079862,"date":"2025-01-08T12:24:48","date_gmt":"2025-01-08T04:24:48","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1079862.html"},"modified":"2025-01-08T12:24:51","modified_gmt":"2025-01-08T04:24:51","slug":"python%e4%b8%ad%e5%a6%82%e4%bd%95%e8%ae%a1%e7%ae%97%e5%ad%97%e7%ac%a6%e4%b8%b2%e4%b8%aa%e6%95%b0-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1079862.html","title":{"rendered":"python\u4e2d\u5982\u4f55\u8ba1\u7b97\u5b57\u7b26\u4e32\u4e2a\u6570"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24182708\/99d0d5e1-793f-4ba3-a6c8-80987b590581.webp\" alt=\"python\u4e2d\u5982\u4f55\u8ba1\u7b97\u5b57\u7b26\u4e32\u4e2a\u6570\" \/><\/p>\n<p><p> <strong>\u5728Python\u4e2d\uff0c\u8ba1\u7b97\u5b57\u7b26\u4e32\u4e2a\u6570\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\u4f7f\u7528len()\u51fd\u6570\u3001count()\u65b9\u6cd5\u3001\u6b63\u5219\u8868\u8fbe\u5f0f\u7b49\u3002<\/strong> \u5176\u4e2d\u6700\u5e38\u7528\u548c\u76f4\u63a5\u7684\u65b9\u6cd5\u662f\u901a\u8fc7\u5185\u7f6e\u7684len()\u51fd\u6570\u6765\u83b7\u53d6\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\u3002\u4e3e\u4f8b\u6765\u8bf4\uff0c\u5b57\u7b26\u4e32&quot;hello&quot;\u7684\u957f\u5ea6\u53ef\u4ee5\u901a\u8fc7len(&quot;hello&quot;)\u5f97\u52305\u3002\u63a5\u4e0b\u6765\u6211\u4eec\u5c06\u8be6\u7ec6\u8ba8\u8bba\u8fd9\u4e9b\u65b9\u6cd5\u5e76\u4ecb\u7ecd\u5176\u4e2d\u4e00\u79cd\u65b9\u6cd5\u7684\u5b9e\u9645\u5e94\u7528\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528len()\u51fd\u6570<\/h3>\n<\/p>\n<p><p>len()\u51fd\u6570\u662fPython\u5185\u7f6e\u51fd\u6570\u4e4b\u4e00\uff0c\u7528\u4e8e\u83b7\u53d6\u5b57\u7b26\u4e32\u3001\u5217\u8868\u3001\u5143\u7ec4\u7b49\u6570\u636e\u7ed3\u6784\u7684\u957f\u5ea6\u3002\u5176\u4f7f\u7528\u65b9\u6cd5\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u9700\u5c06\u5b57\u7b26\u4e32\u4f5c\u4e3a\u53c2\u6570\u4f20\u5165\u5373\u53ef\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u793a\u4f8b\u4ee3\u7801<\/p>\n<p>my_string = &quot;hello world&quot;<\/p>\n<p>length = len(my_string)<\/p>\n<p>print(f&quot;The length of the string is: {length}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u8ff0\u4ee3\u7801\u4e2d\uff0c<code>len(my_string)<\/code>\u8fd4\u56de\u5b57\u7b26\u4e32<code>my_string<\/code>\u7684\u957f\u5ea6\uff0c\u537311\u3002\u8be5\u65b9\u6cd5\u9002\u7528\u4e8e\u6240\u6709\u7c7b\u578b\u7684\u5b57\u7b26\u4e32\uff0c\u65e0\u8bba\u5176\u5185\u5bb9\u662f\u4ec0\u4e48\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528count()\u65b9\u6cd5<\/h3>\n<\/p>\n<p><p>count()\u65b9\u6cd5\u7528\u4e8e\u7edf\u8ba1\u67d0\u4e2a\u5b50\u5b57\u7b26\u4e32\u5728\u7236\u5b57\u7b26\u4e32\u4e2d\u51fa\u73b0\u7684\u6b21\u6570\u3002\u867d\u7136\u5b83\u4e0d\u76f4\u63a5\u7528\u4e8e\u8ba1\u7b97\u5b57\u7b26\u4e32\u957f\u5ea6\uff0c\u4f46\u53ef\u4ee5\u7528\u6765\u7edf\u8ba1\u67d0\u4e9b\u7279\u5b9a\u5b57\u7b26\u7684\u51fa\u73b0\u6b21\u6570\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u793a\u4f8b\u4ee3\u7801<\/p>\n<p>my_string = &quot;hello world&quot;<\/p>\n<p>count_l = my_string.count(&#39;l&#39;)<\/p>\n<p>print(f&quot;The character &#39;l&#39; appears {count_l} times in the string.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code>my_string.count(&#39;l&#39;)<\/code>\u8fd4\u56de\u5b57\u7b26&#39;l&#39;\u5728\u5b57\u7b26\u4e32\u4e2d\u51fa\u73b0\u7684\u6b21\u6570\uff0c\u53733\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f<\/h3>\n<\/p>\n<p><p>\u6b63\u5219\u8868\u8fbe\u5f0f\uff08Regular Expression\uff09\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u6587\u672c\u5904\u7406\u5de5\u5177\uff0c\u80fd\u591f\u5339\u914d\u590d\u6742\u7684\u5b57\u7b26\u4e32\u6a21\u5f0f\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528re\u6a21\u5757\u6765\u8fdb\u884c\u6b63\u5219\u8868\u8fbe\u5f0f\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<h2><strong>\u793a\u4f8b\u4ee3\u7801<\/strong><\/h2>\n<p>my_string = &quot;hello world&quot;<\/p>\n<p>pattern = r&#39;\\w+&#39;  # \u5339\u914d\u5355\u8bcd\u5b57\u7b26<\/p>\n<p>matches = re.findall(pattern, my_string)<\/p>\n<p>length = sum(len(match) for match in matches)<\/p>\n<p>print(f&quot;The total length of all words is: {length}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code>re.findall(pattern, my_string)<\/code>\u8fd4\u56de\u4e00\u4e2a\u5339\u914d\u7684\u5355\u8bcd\u5217\u8868\uff0c\u7136\u540e\u901a\u8fc7\u8ba1\u7b97\u8fd9\u4e9b\u5355\u8bcd\u7684\u957f\u5ea6\u4e4b\u548c\u6765\u5f97\u5230\u603b\u957f\u5ea6\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u4f7f\u7528\u5faa\u73af\u8ba1\u7b97<\/h3>\n<\/p>\n<p><p>\u867d\u7136\u8fd9\u79cd\u65b9\u6cd5\u8f83\u4e3a\u7e41\u7410\uff0c\u4f46\u5b83\u80fd\u591f\u5c55\u793a\u8ba1\u7b97\u5b57\u7b26\u4e32\u957f\u5ea6\u7684\u5e95\u5c42\u903b\u8f91\u3002\u901a\u8fc7\u904d\u5386\u5b57\u7b26\u4e32\u7684\u6bcf\u4e00\u4e2a\u5b57\u7b26\u5e76\u8fdb\u884c\u8ba1\u6570\uff0c\u53ef\u4ee5\u624b\u52a8\u8ba1\u7b97\u51fa\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u793a\u4f8b\u4ee3\u7801<\/p>\n<p>my_string = &quot;hello world&quot;<\/p>\n<p>length = 0<\/p>\n<p>for char in my_string:<\/p>\n<p>    length += 1<\/p>\n<p>print(f&quot;The length of the string is: {length}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u901a\u8fc7\u904d\u5386\u5b57\u7b26\u4e32\u4e2d\u7684\u6bcf\u4e00\u4e2a\u5b57\u7b26\u5e76\u9012\u589e\u8ba1\u6570\u5668<code>length<\/code>\u6765\u8ba1\u7b97\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u7ed3\u5408\u591a\u79cd\u65b9\u6cd5\u8fdb\u884c\u9ad8\u7ea7\u64cd\u4f5c<\/h3>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u53ef\u80fd\u9700\u8981\u7ed3\u5408\u591a\u79cd\u65b9\u6cd5\u6765\u5904\u7406\u590d\u6742\u7684\u5b57\u7b26\u4e32\u64cd\u4f5c\u3002\u4f8b\u5982\uff0c\u5728\u6570\u636e\u6e05\u6d17\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u80fd\u9700\u8981\u53bb\u9664\u7279\u6b8a\u5b57\u7b26\u3001\u7edf\u8ba1\u7279\u5b9a\u5b57\u7b26\u7684\u51fa\u73b0\u6b21\u6570\u3001\u4ee5\u53ca\u8ba1\u7b97\u6700\u7ec8\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<h2><strong>\u793a\u4f8b\u4ee3\u7801<\/strong><\/h2>\n<p>def clean_and_count(input_string):<\/p>\n<p>    # \u53bb\u9664\u7279\u6b8a\u5b57\u7b26<\/p>\n<p>    cleaned_string = re.sub(r&#39;[^\\w\\s]&#39;, &#39;&#39;, input_string)<\/p>\n<p>    # \u7edf\u8ba1\u5b57\u6bcd\u5b57\u7b26\u7684\u4e2a\u6570<\/p>\n<p>    alpha_count = sum(char.isalpha() for char in cleaned_string)<\/p>\n<p>    return alpha_count<\/p>\n<p>my_string = &quot;Hello, World! 123&quot;<\/p>\n<p>alpha_count = clean_and_count(my_string)<\/p>\n<p>print(f&quot;The number of alphabetic characters is: {alpha_count}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u9996\u5148\u901a\u8fc7\u6b63\u5219\u8868\u8fbe\u5f0f\u53bb\u9664\u5b57\u7b26\u4e32\u4e2d\u7684\u7279\u6b8a\u5b57\u7b26\uff0c\u7136\u540e\u7edf\u8ba1\u6e05\u7406\u540e\u7684\u5b57\u7b26\u4e32\u4e2d\u6240\u6709\u5b57\u6bcd\u5b57\u7b26\u7684\u4e2a\u6570\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u5b57\u7b26\u4e32\u957f\u5ea6\u4e0e\u5b57\u7b26\u7f16\u7801<\/h3>\n<\/p>\n<p><p>\u5728\u5904\u7406\u591a\u5b57\u8282\u5b57\u7b26\uff08\u5982\u4e2d\u6587\u3001\u65e5\u6587\u3001\u97e9\u6587\u7b49\uff09\u65f6\uff0c\u9700\u8981\u6ce8\u610f\u5b57\u7b26\u7f16\u7801\u7684\u95ee\u9898\u3002Python\u4e2d\u7684\u5b57\u7b26\u4e32\u662fUnicode\u7f16\u7801\uff0clen()\u51fd\u6570\u8fd4\u56de\u7684\u662f\u5b57\u7b26\u6570\u800c\u4e0d\u662f\u5b57\u8282\u6570\u3002\u5982\u679c\u9700\u8981\u83b7\u53d6\u5b57\u8282\u957f\u5ea6\uff0c\u53ef\u4ee5\u4f7f\u7528encode()\u65b9\u6cd5\u5c06\u5b57\u7b26\u4e32\u7f16\u7801\u4e3a\u5b57\u8282\u5e8f\u5217\u540e\u518d\u8ba1\u7b97\u957f\u5ea6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u793a\u4f8b\u4ee3\u7801<\/p>\n<p>my_string = &quot;\u4f60\u597d\uff0c\u4e16\u754c&quot;<\/p>\n<p>byte_length = len(my_string.encode(&#39;utf-8&#39;))<\/p>\n<p>print(f&quot;The byte length of the string is: {byte_length}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code>my_string.encode(&#39;utf-8&#39;)<\/code>\u5c06\u5b57\u7b26\u4e32\u7f16\u7801\u4e3aUTF-8\u5b57\u8282\u5e8f\u5217\uff0c<code>len()<\/code>\u51fd\u6570\u8fd4\u56de\u5176\u5b57\u8282\u957f\u5ea6\uff0c\u537315\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u6027\u80fd\u6bd4\u8f83<\/h3>\n<\/p>\n<p><p>\u5728\u5904\u7406\u5927\u89c4\u6a21\u6570\u636e\u65f6\uff0c\u6027\u80fd\u662f\u4e00\u4e2a\u5173\u952e\u56e0\u7d20\u3002\u4e0d\u540c\u65b9\u6cd5\u7684\u6027\u80fd\u53ef\u80fd\u6709\u6240\u5dee\u5f02\uff0c\u56e0\u6b64\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u975e\u5e38\u91cd\u8981\u3002\u4ee5\u4e0b\u662f\u4e0d\u540c\u65b9\u6cd5\u5728\u8ba1\u7b97\u5b57\u7b26\u4e32\u957f\u5ea6\u65f6\u7684\u6027\u80fd\u6bd4\u8f83\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import time<\/p>\n<h2><strong>\u793a\u4f8b\u4ee3\u7801<\/strong><\/h2>\n<p>def performance_test():<\/p>\n<p>    my_string = &quot;a&quot; * 107  # \u521b\u5efa\u4e00\u4e2a\u957f\u5ea6\u4e3a10000000\u7684\u5b57\u7b26\u4e32<\/p>\n<p>    start = time.time()<\/p>\n<p>    len(my_string)<\/p>\n<p>    end = time.time()<\/p>\n<p>    print(f&quot;len() function took: {end - start} seconds&quot;)<\/p>\n<p>    start = time.time()<\/p>\n<p>    sum(1 for _ in my_string)<\/p>\n<p>    end = time.time()<\/p>\n<p>    print(f&quot;Loop method took: {end - start} seconds&quot;)<\/p>\n<p>performance_test()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2a\u957f\u5ea6\u4e3a10000000\u7684\u5b57\u7b26\u4e32\uff0c\u5e76\u5206\u522b\u4f7f\u7528<code>len()<\/code>\u51fd\u6570\u548c\u5faa\u73af\u65b9\u6cd5\u8ba1\u7b97\u5176\u957f\u5ea6\u3002\u901a\u8fc7\u5bf9\u6bd4\u4e24\u8005\u7684\u6267\u884c\u65f6\u95f4\uff0c\u53ef\u4ee5\u53d1\u73b0<code>len()<\/code>\u51fd\u6570\u7684\u6027\u80fd\u660e\u663e\u4f18\u4e8e\u5faa\u73af\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><h3>\u516b\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u8ba1\u7b97\u5b57\u7b26\u4e32\u4e2a\u6570\u7684\u65b9\u6cd5\u6709\u5f88\u591a\uff0c\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u53d6\u51b3\u4e8e\u5177\u4f53\u7684\u5e94\u7528\u573a\u666f\u548c\u6027\u80fd\u8981\u6c42\u3002<strong>len()\u51fd\u6570\u662f\u6700\u5e38\u7528\u4e14\u9ad8\u6548\u7684\u65b9\u6cd5<\/strong>\uff0c\u9002\u7528\u4e8e\u5927\u591a\u6570\u60c5\u51b5\uff1b<strong>count()\u65b9\u6cd5\u548c\u6b63\u5219\u8868\u8fbe\u5f0f<\/strong>\u5219\u9002\u7528\u4e8e\u7279\u5b9a\u5b57\u7b26\u6216\u6a21\u5f0f\u7684\u7edf\u8ba1\uff1b<strong>\u5faa\u73af\u65b9\u6cd5<\/strong>\u53ef\u4ee5\u5c55\u793a\u5e95\u5c42\u903b\u8f91\uff0c\u4f46\u6027\u80fd\u8f83\u5dee\uff1b<strong>\u7ed3\u5408\u591a\u79cd\u65b9\u6cd5<\/strong>\u8fdb\u884c\u9ad8\u7ea7\u64cd\u4f5c\u53ef\u4ee5\u6ee1\u8db3\u590d\u6742\u7684\u9700\u6c42\uff1b\u5728\u5904\u7406\u591a\u5b57\u8282\u5b57\u7b26\u65f6\uff0c\u9700\u8981\u8003\u8651\u5b57\u7b26\u7f16\u7801\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u5bf9\u4e0d\u540c\u65b9\u6cd5\u7684\u6bd4\u8f83\u548c\u5e94\u7528\uff0c\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u6700\u9002\u5408\u7684\u65b9\u6cd5\u6765\u8ba1\u7b97\u5b57\u7b26\u4e32\u4e2a\u6570\u3002\u8fd9\u4e0d\u4ec5\u6709\u52a9\u4e8e\u63d0\u9ad8\u4ee3\u7801\u7684\u6548\u7387\uff0c\u8fd8\u80fd\u589e\u5f3a\u5bf9\u5b57\u7b26\u4e32\u64cd\u4f5c\u7684\u7406\u89e3\u548c\u5e94\u7528\u80fd\u529b\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5728Python\u4e2d\uff0c\u5982\u4f55\u7edf\u8ba1\u4e00\u4e2a\u5b57\u7b26\u4e32\u4e2d\u67d0\u4e2a\u7279\u5b9a\u5b57\u7b26\u7684\u51fa\u73b0\u6b21\u6570\uff1f<\/strong><br \/>\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u4e32\u7684<code>count()<\/code>\u65b9\u6cd5\u6765\u7edf\u8ba1\u67d0\u4e2a\u7279\u5b9a\u5b57\u7b26\u5728\u5b57\u7b26\u4e32\u4e2d\u51fa\u73b0\u7684\u6b21\u6570\u3002\u4f8b\u5982\uff0c<code>my_string.count(&#39;a&#39;)<\/code>\u53ef\u4ee5\u8ba1\u7b97\u5b57\u7b26\u4e32<code>my_string<\/code>\u4e2d\u5b57\u7b26<code>&#39;a&#39;<\/code>\u51fa\u73b0\u7684\u6b21\u6570\u3002\u8fd9\u4e2a\u65b9\u6cd5\u975e\u5e38\u76f4\u89c2\u4e14\u6613\u4e8e\u4f7f\u7528\u3002<\/p>\n<p><strong>\u4f7f\u7528Python\u5982\u4f55\u8ba1\u7b97\u591a\u4e2a\u5b57\u7b26\u4e32\u4e2d\u5b57\u7b26\u7684\u603b\u6570\uff1f<\/strong><br \/>\u53ef\u4ee5\u901a\u8fc7\u5faa\u73af\u904d\u5386\u591a\u4e2a\u5b57\u7b26\u4e32\uff0c\u5e76\u5bf9\u6bcf\u4e2a\u5b57\u7b26\u4e32\u4f7f\u7528<code>len()<\/code>\u51fd\u6570\u6765\u8ba1\u7b97\u5b57\u7b26\u603b\u6570\u3002\u5c06\u6240\u6709\u5b57\u7b26\u4e32\u7684\u5b57\u7b26\u6570\u7d2f\u52a0\u8d77\u6765\uff0c\u60a8\u5c31\u53ef\u4ee5\u5f97\u5230\u603b\u7684\u5b57\u7b26\u6570\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528\u5217\u8868\u63a8\u5bfc\u5f0f\u7ed3\u5408<code>sum()<\/code>\u51fd\u6570\u6765\u7b80\u5316\u8fd9\u4e00\u8fc7\u7a0b\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Python\u4e2d\u8ba1\u7b97\u5b57\u7b26\u4e32\u4e2d\u5355\u8bcd\u7684\u6570\u91cf\uff1f<\/strong><br \/>\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u4e32\u7684<code>split()<\/code>\u65b9\u6cd5\u5c06\u5b57\u7b26\u4e32\u6309\u7a7a\u683c\u5206\u5272\u6210\u5355\u8bcd\u5217\u8868\uff0c\u7136\u540e\u4f7f\u7528<code>len()<\/code>\u51fd\u6570\u8ba1\u7b97\u5217\u8868\u7684\u957f\u5ea6\u3002\u8fd9\u79cd\u65b9\u6cd5\u80fd\u591f\u6709\u6548\u5730\u7edf\u8ba1\u5b57\u7b26\u4e32\u4e2d\u7684\u5355\u8bcd\u6570\u91cf\u3002\u4f8b\u5982\uff0c<code>len(my_string.split())<\/code>\u5c06\u8fd4\u56de\u5b57\u7b26\u4e32<code>my_string<\/code>\u4e2d\u7684\u5355\u8bcd\u603b\u6570\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\uff0c\u8ba1\u7b97\u5b57\u7b26\u4e32\u4e2a\u6570\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\u4f7f\u7528len()\u51fd\u6570\u3001count()\u65b9\u6cd5\u3001\u6b63\u5219\u8868\u8fbe\u5f0f\u7b49\u3002 \u5176\u4e2d [&hellip;]","protected":false},"author":3,"featured_media":1079869,"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\/1079862"}],"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=1079862"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1079862\/revisions"}],"predecessor-version":[{"id":1079871,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1079862\/revisions\/1079871"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1079869"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1079862"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1079862"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1079862"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}