{"id":1145652,"date":"2025-01-08T23:09:58","date_gmt":"2025-01-08T15:09:58","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1145652.html"},"modified":"2025-01-08T23:10:01","modified_gmt":"2025-01-08T15:10:01","slug":"python%e5%a6%82%e4%bd%95%e4%b8%a4%e4%b8%aa%e4%b8%a4%e4%b8%aa%e8%be%93%e5%87%ba%e5%ad%97%e7%ac%a6%e4%b8%b2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1145652.html","title":{"rendered":"python\u5982\u4f55\u4e24\u4e2a\u4e24\u4e2a\u8f93\u51fa\u5b57\u7b26\u4e32"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24182127\/53c3df7d-9046-45fb-b907-3c2ea9cc0894.webp\" alt=\"python\u5982\u4f55\u4e24\u4e2a\u4e24\u4e2a\u8f93\u51fa\u5b57\u7b26\u4e32\" \/><\/p>\n<p><p> <strong>\u5728Python\u4e2d\uff0c\u4e24\u4e2a\u4e24\u4e2a\u8f93\u51fa\u5b57\u7b26\u4e32\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u4e3b\u8981\u5305\u62ec\u4f7f\u7528\u5207\u7247\u3001\u5faa\u73af\u4ee5\u53ca\u5217\u8868\u63a8\u5bfc\u5f0f\u7b49\u3002<\/strong> \u5176\u4e2d\uff0c\u6700\u5e38\u7528\u7684\u662f\u5229\u7528\u5207\u7247\u548c\u5faa\u73af\u6765\u5b9e\u73b0\u3002\u5207\u7247\u64cd\u4f5c\u65b9\u4fbf\u5feb\u6377\uff0c\u9002\u5408\u5904\u7406\u7b80\u5355\u7684\u5b57\u7b26\u4e32\u62c6\u5206\uff1b\u800c\u5faa\u73af\u5219\u63d0\u4f9b\u4e86\u66f4\u7075\u6d3b\u7684\u5904\u7406\u65b9\u5f0f\uff0c\u9002\u5408\u9700\u8981\u5bf9\u6bcf\u5bf9\u5b57\u7b26\u8fdb\u884c\u989d\u5916\u5904\u7406\u7684\u573a\u666f\u3002\u4ee5\u4e0b\u5c06\u8be6\u7ec6\u63cf\u8ff0\u5982\u4f55\u4f7f\u7528\u8fd9\u4e24\u79cd\u65b9\u6cd5\u6765\u5b9e\u73b0\u4e24\u4e2a\u4e24\u4e2a\u8f93\u51fa\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><h2>\u4e00\u3001\u4f7f\u7528\u5b57\u7b26\u4e32\u5207\u7247<\/h2>\n<\/p>\n<p><h3>1. \u5207\u7247\u57fa\u7840<\/h3>\n<\/p>\n<p><p>Python\u7684\u5b57\u7b26\u4e32\u5207\u7247\u529f\u80fd\u975e\u5e38\u5f3a\u5927\uff0c\u53ef\u4ee5\u8f7b\u677e\u5730\u5b9e\u73b0\u591a\u4e2a\u5b57\u7b26\u7684\u63d0\u53d6\u3002\u901a\u8fc7\u5207\u7247\uff0c\u53ef\u4ee5\u6307\u5b9a\u8d77\u59cb\u4f4d\u7f6e\u3001\u7ed3\u675f\u4f4d\u7f6e\u548c\u6b65\u957f\uff0c\u4ece\u800c\u7075\u6d3b\u5730\u83b7\u53d6\u5b57\u7b26\u4e32\u4e2d\u7684\u90e8\u5206\u5185\u5bb9\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">text = &quot;abcdefgh&quot;<\/p>\n<h2><strong>\u4f7f\u7528\u5207\u7247\u65b9\u6cd5\uff0c\u6bcf\u4e24\u4e2a\u5b57\u7b26\u8f93\u51fa\u4e00\u6b21<\/strong><\/h2>\n<p>for i in range(0, len(text), 2):<\/p>\n<p>    print(text[i:i+2])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c<code>range(0, len(text), 2)<\/code>\u751f\u6210\u4e86\u4e00\u4e2a\u4ee52\u4e3a\u6b65\u957f\u7684\u5e8f\u5217\uff0c\u4ece0\u5f00\u59cb\uff0c\u76f4\u5230\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\u3002<code>text[i:i+2]<\/code>\u5219\u8868\u793a\u4ece\u7d22\u5f15<code>i<\/code>\u5f00\u59cb\uff0c\u83b7\u53d6\u4e24\u4e2a\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><h3>2. \u5207\u7247\u8fdb\u9636<\/h3>\n<\/p>\n<p><p>\u5207\u7247\u4e0d\u4ec5\u53ef\u4ee5\u7528\u4e8e\u7b80\u5355\u7684\u63d0\u53d6\uff0c\u8fd8\u53ef\u4ee5\u7ed3\u5408\u5176\u4ed6Python\u7279\u6027\uff0c\u8fdb\u884c\u66f4\u590d\u6742\u7684\u64cd\u4f5c\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u5c06\u4e24\u4e2a\u4e24\u4e2a\u7684\u5b57\u7b26\u7ec4\u5408\u6210\u4e00\u4e2a\u65b0\u7684\u5b57\u7b26\u4e32\u5217\u8868\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">text = &quot;abcdefgh&quot;<\/p>\n<h2><strong>\u4f7f\u7528\u5217\u8868\u63a8\u5bfc\u5f0f\u751f\u6210\u65b0\u7684\u5b57\u7b26\u4e32\u5217\u8868<\/strong><\/h2>\n<p>p<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>rs = [text[i:i+2] for i in range(0, len(text), 2)]<\/p>\n<p>print(pairs)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6837\uff0c<code>pairs<\/code>\u5c06\u662f\u4e00\u4e2a\u5305\u542b\u6bcf\u4e24\u4e2a\u5b57\u7b26\u7684\u5217\u8868\uff1a<code>[&#39;ab&#39;, &#39;cd&#39;, &#39;ef&#39;, &#39;gh&#39;]<\/code>\u3002\u8fd9\u79cd\u65b9\u6cd5\u975e\u5e38\u7b80\u6d01\uff0c\u9002\u5408\u9700\u8981\u8fdb\u4e00\u6b65\u5904\u7406\u6bcf\u5bf9\u5b57\u7b26\u7684\u60c5\u51b5\u3002<\/p>\n<\/p>\n<p><h2>\u4e8c\u3001\u4f7f\u7528\u5faa\u73af<\/h2>\n<\/p>\n<p><h3>1. \u57fa\u672c\u5faa\u73af<\/h3>\n<\/p>\n<p><p>\u5faa\u73af\u662f\u53e6\u4e00\u79cd\u5e38\u7528\u7684\u5b57\u7b26\u4e32\u5904\u7406\u65b9\u6cd5\u3002\u901a\u8fc7\u5faa\u73af\uff0c\u53ef\u4ee5\u66f4\u7075\u6d3b\u5730\u63a7\u5236\u6bcf\u5bf9\u5b57\u7b26\u7684\u5904\u7406\u65b9\u5f0f\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u5728\u8f93\u51fa\u65f6\u6dfb\u52a0\u4e00\u4e9b\u81ea\u5b9a\u4e49\u7684\u683c\u5f0f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">text = &quot;abcdefgh&quot;<\/p>\n<h2><strong>\u4f7f\u7528\u5faa\u73af\uff0c\u6bcf\u4e24\u4e2a\u5b57\u7b26\u8f93\u51fa\u4e00\u6b21<\/strong><\/h2>\n<p>for i in range(0, len(text), 2):<\/p>\n<p>    pair = text[i:i+2]<\/p>\n<p>    # \u5728\u8f93\u51fa\u65f6\u6dfb\u52a0\u81ea\u5b9a\u4e49\u683c\u5f0f<\/p>\n<p>    print(f&quot;Pair: {pair}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2. \u5d4c\u5957\u5faa\u73af<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u9700\u8981\u5bf9\u6bcf\u5bf9\u5b57\u7b26\u8fdb\u884c\u66f4\u590d\u6742\u7684\u64cd\u4f5c\uff0c\u751a\u81f3\u662f\u5d4c\u5957\u7684\u5faa\u73af\u5904\u7406\uff0c\u4e5f\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u5bf9\u6bcf\u5bf9\u5b57\u7b26\u8fdb\u884c\u8fdb\u4e00\u6b65\u7684\u5206\u5272\u548c\u5904\u7406\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">text = &quot;abcdefgh&quot;<\/p>\n<h2><strong>\u4f7f\u7528\u5d4c\u5957\u5faa\u73af\uff0c\u5bf9\u6bcf\u5bf9\u5b57\u7b26\u8fdb\u884c\u8fdb\u4e00\u6b65\u5904\u7406<\/strong><\/h2>\n<p>for i in range(0, len(text), 2):<\/p>\n<p>    pair = text[i:i+2]<\/p>\n<p>    for char in pair:<\/p>\n<p>        # \u5bf9\u6bcf\u4e2a\u5b57\u7b26\u8fdb\u884c\u5904\u7406<\/p>\n<p>        print(f&quot;Character: {char}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u4e09\u3001\u7efc\u5408\u5e94\u7528<\/h2>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u53ef\u80fd\u9700\u8981\u7ed3\u5408\u5207\u7247\u548c\u5faa\u73af\uff0c\u5b9e\u73b0\u590d\u6742\u7684\u5b57\u7b26\u4e32\u5904\u7406\u4efb\u52a1\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u5c06\u6bcf\u4e24\u4e2a\u5b57\u7b26\u8f6c\u6362\u6210\u4e00\u4e2a\u7279\u5b9a\u7684\u683c\u5f0f\uff0c\u5e76\u5b58\u50a8\u5230\u4e00\u4e2a\u5b57\u5178\u4e2d\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">text = &quot;abcdefgh&quot;<\/p>\n<h2><strong>\u4f7f\u7528\u5207\u7247\u548c\u5faa\u73af\uff0c\u5c06\u6bcf\u4e24\u4e2a\u5b57\u7b26\u8f6c\u6362\u6210\u7279\u5b9a\u683c\u5f0f\uff0c\u5e76\u5b58\u50a8\u5230\u5b57\u5178\u4e2d<\/strong><\/h2>\n<p>result = {}<\/p>\n<p>for i in range(0, len(text), 2):<\/p>\n<p>    pair = text[i:i+2]<\/p>\n<p>    # \u5c06\u6bcf\u5bf9\u5b57\u7b26\u5b58\u50a8\u5230\u5b57\u5178\u4e2d\uff0c\u952e\u4e3a\u7d22\u5f15\uff0c\u503c\u4e3a\u5b57\u7b26\u5bf9<\/p>\n<p>    result[i\/\/2] = pair<\/p>\n<p>print(result)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code>result<\/code>\u5c06\u662f\u4e00\u4e2a\u5b57\u5178\uff0c\u952e\u4e3a\u6bcf\u5bf9\u5b57\u7b26\u7684\u7d22\u5f15\uff0c\u503c\u4e3a\u5bf9\u5e94\u7684\u5b57\u7b26\u5bf9\uff1a<code>{0: &#39;ab&#39;, 1: &#39;cd&#39;, 2: &#39;ef&#39;, 3: &#39;gh&#39;}<\/code>\u3002\u8fd9\u79cd\u65b9\u6cd5\u7279\u522b\u9002\u5408\u9700\u8981\u5bf9\u6bcf\u5bf9\u5b57\u7b26\u8fdb\u884c\u7d22\u5f15\u6216\u8fdb\u4e00\u6b65\u5904\u7406\u7684\u573a\u666f\u3002<\/p>\n<\/p>\n<p><h2>\u56db\u3001\u5904\u7406\u7279\u6b8a\u60c5\u51b5<\/h2>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u7279\u6b8a\u60c5\u51b5\uff0c\u4f8b\u5982\u5b57\u7b26\u4e32\u957f\u5ea6\u4e0d\u662f\u5076\u6570\uff0c\u6216\u8005\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u7279\u6b8a\u5b57\u7b26\u3002\u5bf9\u4e8e\u8fd9\u4e9b\u60c5\u51b5\uff0c\u53ef\u4ee5\u8fdb\u884c\u989d\u5916\u7684\u5904\u7406\uff0c\u4ee5\u786e\u4fdd\u7a0b\u5e8f\u7684\u5065\u58ee\u6027\u3002<\/p>\n<\/p>\n<p><h3>1. \u5904\u7406\u5947\u6570\u957f\u5ea6\u5b57\u7b26\u4e32<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u5b57\u7b26\u4e32\u957f\u5ea6\u4e0d\u662f\u5076\u6570\uff0c\u53ef\u4ee5\u5728\u63d0\u53d6\u6700\u540e\u4e00\u5bf9\u5b57\u7b26\u65f6\uff0c\u8fdb\u884c\u7279\u6b8a\u5904\u7406\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">text = &quot;abcdefg&quot;<\/p>\n<h2><strong>\u5904\u7406\u5947\u6570\u957f\u5ea6\u5b57\u7b26\u4e32<\/strong><\/h2>\n<p>for i in range(0, len(text), 2):<\/p>\n<p>    pair = text[i:i+2]<\/p>\n<p>    # \u5982\u679c\u6700\u540e\u4e00\u5bf9\u5b57\u7b26\u957f\u5ea6\u4e0d\u8db32\uff0c\u8fdb\u884c\u8865\u5168<\/p>\n<p>    if len(pair) &lt; 2:<\/p>\n<p>        pair += &#39;_&#39;<\/p>\n<p>    print(pair)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u5982\u679c\u5b57\u7b26\u4e32\u957f\u5ea6\u4e3a\u5947\u6570\uff0c\u6700\u540e\u4e00\u5bf9\u5b57\u7b26\u4f1a\u88ab\u8865\u5168\u4e3a\u4e24\u4e2a\u5b57\u7b26\uff0c\u4f8b\u5982<code>&#39;g_&#39;<\/code>\u3002<\/p>\n<\/p>\n<p><h3>2. \u5904\u7406\u7279\u6b8a\u5b57\u7b26<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u7279\u6b8a\u5b57\u7b26\uff0c\u53ef\u4ee5\u5728\u63d0\u53d6\u65f6\u8fdb\u884c\u8fc7\u6ee4\u6216\u66ff\u6362\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import re<\/p>\n<p>text = &quot;abc@def#gh&quot;<\/p>\n<h2><strong>\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u8fc7\u6ee4\u7279\u6b8a\u5b57\u7b26<\/strong><\/h2>\n<p>text = re.sub(r&#39;[^a-zA-Z0-9]&#39;, &#39;&#39;, text)<\/p>\n<h2><strong>\u5904\u7406\u8fc7\u6ee4\u540e\u7684\u5b57\u7b26\u4e32<\/strong><\/h2>\n<p>for i in range(0, len(text), 2):<\/p>\n<p>    pair = text[i:i+2]<\/p>\n<p>    print(pair)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code>re.sub(r&#39;[^a-zA-Z0-9]&#39;, &#39;&#39;, text)<\/code>\u5c06\u6240\u6709\u975e\u5b57\u6bcd\u548c\u6570\u5b57\u7684\u5b57\u7b26\u66ff\u6362\u4e3a\u7a7a\uff0c\u4ece\u800c\u5f97\u5230\u4e00\u4e2a\u53ea\u5305\u542b\u5b57\u6bcd\u548c\u6570\u5b57\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><h2>\u4e94\u3001\u603b\u7ed3<\/h2>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u65b9\u6cd5\uff0c\u53ef\u4ee5\u7075\u6d3b\u5730\u5b9e\u73b0Python\u4e2d\u4e24\u4e2a\u4e24\u4e2a\u8f93\u51fa\u5b57\u7b26\u4e32\u7684\u64cd\u4f5c\u3002\u65e0\u8bba\u662f\u4f7f\u7528\u5207\u7247\u8fd8\u662f\u5faa\u73af\uff0c\u90fd\u53ef\u4ee5\u6839\u636e\u5b9e\u9645\u9700\u6c42\u8fdb\u884c\u8c03\u6574\u548c\u4f18\u5316\u3002<strong>\u5207\u7247\u65b9\u6cd5\u7b80\u6d01\u9ad8\u6548\uff0c\u9002\u5408\u5904\u7406\u7b80\u5355\u7684\u5b57\u7b26\u4e32\u63d0\u53d6\uff1b\u5faa\u73af\u65b9\u6cd5\u7075\u6d3b\u591a\u53d8\uff0c\u9002\u5408\u9700\u8981\u5bf9\u6bcf\u5bf9\u5b57\u7b26\u8fdb\u884c\u590d\u6742\u5904\u7406\u7684\u573a\u666f<\/strong>\u3002\u540c\u65f6\uff0c\u901a\u8fc7\u5bf9\u7279\u6b8a\u60c5\u51b5\u7684\u5904\u7406\uff0c\u53ef\u4ee5\u786e\u4fdd\u7a0b\u5e8f\u7684\u5065\u58ee\u6027\u548c\u53ef\u9760\u6027\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u5b9e\u73b0\u6bcf\u4e24\u4e2a\u5b57\u7b26\u8f93\u51fa\u4e00\u6b21\u5b57\u7b26\u4e32\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u5207\u7247\u64cd\u4f5c\u548c\u5faa\u73af\u6765\u5b9e\u73b0\u6bcf\u4e24\u4e2a\u5b57\u7b26\u8f93\u51fa\u4e00\u6b21\u5b57\u7b26\u4e32\u3002\u901a\u8fc7<code>for<\/code>\u5faa\u73af\u904d\u5386\u5b57\u7b26\u4e32\u7684\u7d22\u5f15\uff0c\u5e76\u4f7f\u7528\u5207\u7247\u6765\u83b7\u53d6\u6bcf\u4e24\u4e2a\u5b57\u7b26\u3002\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a  <\/p>\n<pre><code class=\"language-python\">def print_pairs(s):\n    for i in range(0, len(s), 2):\n        print(s[i:i+2])\n\nprint_pairs(&quot;abcdefg&quot;)\n<\/code><\/pre>\n<p>\u8fd9\u4e2a\u51fd\u6570\u4f1a\u8f93\u51fa\uff1a<code>ab<\/code>, <code>cd<\/code>, <code>ef<\/code>, <code>g<\/code>\u3002<\/p>\n<p><strong>\u6709\u5176\u4ed6\u65b9\u6cd5\u53ef\u4ee5\u5b9e\u73b0\u6bcf\u4e24\u4e2a\u5b57\u7b26\u8f93\u51fa\u5417\uff1f<\/strong><br \/>\u9664\u4e86\u4f7f\u7528\u5faa\u73af\u548c\u5207\u7247\uff0c\u60a8\u8fd8\u53ef\u4ee5\u5229\u7528\u5217\u8868\u63a8\u5bfc\u5f0f\u548c<code>join<\/code>\u65b9\u6cd5\u6765\u5b9e\u73b0\u76f8\u540c\u7684\u529f\u80fd\u3002\u4f8b\u5982\uff1a  <\/p>\n<pre><code class=\"language-python\">s = &quot;abcdefg&quot;\npairs = [s[i:i+2] for i in range(0, len(s), 2)]\noutput = &#39; &#39;.join(pairs)\nprint(output)  # \u8f93\u51fa\uff1aab cd ef g\n<\/code><\/pre>\n<p>\u8fd9\u79cd\u65b9\u6cd5\u66f4\u52a0\u7b80\u6d01\uff0c\u5e76\u4e14\u53ef\u4ee5\u8f7b\u677e\u5730\u5c06\u7ed3\u679c\u5408\u5e76\u6210\u4e00\u4e2a\u5b57\u7b26\u4e32\u3002<\/p>\n<p><strong>\u5728\u5904\u7406Unicode\u5b57\u7b26\u4e32\u65f6\uff0c\u6709\u4ec0\u4e48\u9700\u8981\u6ce8\u610f\u7684\u5417\uff1f<\/strong><br \/>\u5904\u7406Unicode\u5b57\u7b26\u4e32\u65f6\uff0c\u786e\u4fdd\u5b57\u7b26\u4e32\u7684\u7f16\u7801\u683c\u5f0f\u6b63\u786e\u3002Python 3\u9ed8\u8ba4\u4f7f\u7528Unicode\u7f16\u7801\uff0c\u56e0\u6b64\u76f4\u63a5\u5728\u5b57\u7b26\u4e32\u4e2d\u4f7f\u7528\u4e2d\u6587\u6216\u5176\u4ed6\u8bed\u8a00\u7684\u5b57\u7b26\u5e94\u8be5\u6ca1\u6709\u95ee\u9898\u3002\u7136\u800c\uff0c\u5207\u7247\u548c\u7d22\u5f15\u64cd\u4f5c\u9700\u8981\u786e\u4fdd\u5b57\u7b26\u7684\u5b8c\u6574\u6027\uff0c\u907f\u514d\u534a\u4e2a\u5b57\u7b26\u88ab\u5207\u5272\u3002\u4f8b\u5982\uff0c\u5f53\u5904\u7406\u4e2d\u6587\u5b57\u7b26\u65f6\uff0c\u5efa\u8bae\u4f7f\u7528<code>len()<\/code>\u51fd\u6570\u6765\u8ba1\u7b97\u5b57\u7b26\u6570\u800c\u4e0d\u662f\u5b57\u8282\u6570\uff0c\u4ee5\u786e\u4fdd\u6bcf\u4e2a\u5b57\u7b26\u90fd\u80fd\u5b8c\u6574\u8f93\u51fa\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\uff0c\u4e24\u4e2a\u4e24\u4e2a\u8f93\u51fa\u5b57\u7b26\u4e32\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u4e3b\u8981\u5305\u62ec\u4f7f\u7528\u5207\u7247\u3001\u5faa\u73af\u4ee5\u53ca\u5217\u8868\u63a8\u5bfc\u5f0f\u7b49\u3002 \u5176\u4e2d\uff0c\u6700\u5e38\u7528\u7684\u662f\u5229 [&hellip;]","protected":false},"author":3,"featured_media":1145664,"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\/1145652"}],"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=1145652"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1145652\/revisions"}],"predecessor-version":[{"id":1145667,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1145652\/revisions\/1145667"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1145664"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1145652"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1145652"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1145652"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}