{"id":1146882,"date":"2025-01-08T23:20:41","date_gmt":"2025-01-08T15:20:41","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1146882.html"},"modified":"2025-01-08T23:20:43","modified_gmt":"2025-01-08T15:20:43","slug":"python%e5%a6%82%e4%bd%95%e5%88%a4%e6%96%ad%e4%b8%80%e4%b8%aa%e5%ad%97%e7%ac%a6%e4%b8%b2%e6%98%af%e7%a9%ba%e5%80%bc","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1146882.html","title":{"rendered":"python\u5982\u4f55\u5224\u65ad\u4e00\u4e2a\u5b57\u7b26\u4e32\u662f\u7a7a\u503c"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24182727\/32a6a3b1-2679-4fdd-a440-5516138ca499.webp\" alt=\"python\u5982\u4f55\u5224\u65ad\u4e00\u4e2a\u5b57\u7b26\u4e32\u662f\u7a7a\u503c\" \/><\/p>\n<p><p> <strong>Python\u5224\u65ad\u4e00\u4e2a\u5b57\u7b26\u4e32\u662f\u5426\u4e3a\u7a7a\u503c\u7684\u5e38\u89c1\u65b9\u6cd5\u6709\uff1a\u4f7f\u7528len()\u51fd\u6570\u3001\u4f7f\u7528\u76f4\u63a5\u6bd4\u8f83\u3001\u4f7f\u7528strip()\u65b9\u6cd5\u53bb\u9664\u7a7a\u767d\u5b57\u7b26\u540e\u518d\u6bd4\u8f83\u3002<\/strong> \u5176\u4e2d\uff0c\u4f7f\u7528len()\u51fd\u6570\u662f\u4e00\u79cd\u975e\u5e38\u76f4\u89c2\u548c\u7b80\u5355\u7684\u65b9\u6cd5\u3002\u901a\u8fc7\u5224\u65ad\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\u662f\u5426\u4e3a\u96f6\uff0c\u53ef\u4ee5\u5feb\u901f\u786e\u5b9a\u5b57\u7b26\u4e32\u662f\u5426\u4e3a\u7a7a\u3002\u4e0b\u9762\u8be6\u7ec6\u5c55\u5f00\u8fd9\u4e00\u70b9\u3002<\/p>\n<\/p>\n<p><p>\u4f7f\u7528len()\u51fd\u6570\u5224\u65ad\u5b57\u7b26\u4e32\u662f\u5426\u4e3a\u7a7a\u503c\u7684\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">if len(my_string) == 0:<\/p>\n<p>    print(&quot;The string is empty&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;The string is not empty&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u8fd9\u4e2a\u65b9\u6cd5\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u5230\uff0c<code>len()<\/code>\u51fd\u6570\u8fd4\u56de\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\uff0c\u5982\u679c\u957f\u5ea6\u4e3a0\uff0c\u5219\u8bf4\u660e\u5b57\u7b26\u4e32\u4e3a\u7a7a\u503c\u3002\u8fd9\u79cd\u65b9\u6cd5\u975e\u5e38\u76f4\u89c2\uff0c\u9002\u5408\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u7684\u4f7f\u7528\u3002<\/p>\n<\/p>\n<p><h2>\u4e00\u3001\u4f7f\u7528len()\u51fd\u6570<\/h2>\n<\/p>\n<p><p>\u4f7f\u7528<code>len()<\/code>\u51fd\u6570\u662f\u4e00\u79cd\u7b80\u5355\u4e14\u9ad8\u6548\u7684\u65b9\u6cd5\u6765\u5224\u65ad\u5b57\u7b26\u4e32\u662f\u5426\u4e3a\u7a7a\u3002\u8fd9\u4e2a\u65b9\u6cd5\u7684\u6838\u5fc3\u601d\u60f3\u662f\u901a\u8fc7\u8ba1\u7b97\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\uff0c\u7136\u540e\u6839\u636e\u957f\u5ea6\u662f\u5426\u4e3a\u96f6\u6765\u5224\u65ad\u5b57\u7b26\u4e32\u662f\u5426\u4e3a\u7a7a\u3002<\/p>\n<\/p>\n<p><h3>1\u3001\u57fa\u672c\u7528\u6cd5<\/h3>\n<\/p>\n<p><p>\u57fa\u672c\u4f7f\u7528<code>len()<\/code>\u51fd\u6570\u7684\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_string = &quot;&quot;<\/p>\n<p>if len(my_string) == 0:<\/p>\n<p>    print(&quot;The string is empty&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;The string is not empty&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u5982\u679c\u5b57\u7b26\u4e32<code>my_string<\/code>\u7684\u957f\u5ea6\u4e3a0\uff0c\u90a3\u4e48<code>len(my_string)<\/code>\u5c06\u8fd4\u56de0\uff0c\u8868\u793a\u5b57\u7b26\u4e32\u4e3a\u7a7a\u3002<\/p>\n<\/p>\n<p><h3>2\u3001\u7ed3\u5408\u5176\u4ed6\u6761\u4ef6<\/h3>\n<\/p>\n<p><p>\u6211\u4eec\u8fd8\u53ef\u4ee5\u7ed3\u5408\u5176\u4ed6\u6761\u4ef6\u4f7f\u7528<code>len()<\/code>\u51fd\u6570\u3002\u4f8b\u5982\uff0c\u5982\u679c\u8981\u5224\u65ad\u5b57\u7b26\u4e32\u5728\u53bb\u9664\u7a7a\u767d\u5b57\u7b26\u540e\u662f\u5426\u4e3a\u7a7a\uff0c\u53ef\u4ee5\u7ed3\u5408\u4f7f\u7528<code>strip()<\/code>\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_string = &quot;  &quot;<\/p>\n<p>if len(my_string.strip()) == 0:<\/p>\n<p>    print(&quot;The string is empty or cont<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>ns only whitespace&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;The string is not empty&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u79cd\u65b9\u6cd5\u5728\u5904\u7406\u7528\u6237\u8f93\u5165\u65f6\u7279\u522b\u6709\u7528\uff0c\u56e0\u4e3a\u7528\u6237\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u53ef\u80fd\u5305\u542b\u7a7a\u767d\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><h2>\u4e8c\u3001\u4f7f\u7528\u76f4\u63a5\u6bd4\u8f83<\/h2>\n<\/p>\n<p><p>\u76f4\u63a5\u6bd4\u8f83\u662f\u4e00\u79cd\u66f4\u4e3a\u7b80\u5355\u548c\u76f4\u89c2\u7684\u65b9\u6cd5\uff0c\u901a\u8fc7\u5c06\u5b57\u7b26\u4e32\u4e0e\u7a7a\u5b57\u7b26\u4e32\u8fdb\u884c\u6bd4\u8f83\uff0c\u53ef\u4ee5\u5feb\u901f\u5224\u65ad\u5b57\u7b26\u4e32\u662f\u5426\u4e3a\u7a7a\u3002<\/p>\n<\/p>\n<p><h3>1\u3001\u57fa\u672c\u7528\u6cd5<\/h3>\n<\/p>\n<p><p>\u57fa\u672c\u4f7f\u7528\u76f4\u63a5\u6bd4\u8f83\u7684\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_string = &quot;&quot;<\/p>\n<p>if my_string == &quot;&quot;:<\/p>\n<p>    print(&quot;The string is empty&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;The string is not empty&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u76f4\u63a5\u5c06\u5b57\u7b26\u4e32<code>my_string<\/code>\u4e0e\u7a7a\u5b57\u7b26\u4e32<code>&quot;&quot;<\/code>\u8fdb\u884c\u6bd4\u8f83\uff0c\u5982\u679c\u76f8\u7b49\u5219\u8bf4\u660e\u5b57\u7b26\u4e32\u4e3a\u7a7a\u3002<\/p>\n<\/p>\n<p><h3>2\u3001\u7ed3\u5408\u5176\u4ed6\u6761\u4ef6<\/h3>\n<\/p>\n<p><p>\u540c\u6837\uff0c\u6211\u4eec\u53ef\u4ee5\u7ed3\u5408<code>strip()<\/code>\u65b9\u6cd5\u4f7f\u7528\u76f4\u63a5\u6bd4\u8f83\uff0c\u4ee5\u5904\u7406\u5305\u542b\u7a7a\u767d\u5b57\u7b26\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_string = &quot;  &quot;<\/p>\n<p>if my_string.strip() == &quot;&quot;:<\/p>\n<p>    print(&quot;The string is empty or contains only whitespace&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;The string is not empty&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u79cd\u65b9\u6cd5\u540c\u6837\u9002\u7528\u4e8e\u5904\u7406\u7528\u6237\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><h2>\u4e09\u3001\u4f7f\u7528strip()\u65b9\u6cd5<\/h2>\n<\/p>\n<p><p><code>strip()<\/code>\u65b9\u6cd5\u53ef\u4ee5\u53bb\u9664\u5b57\u7b26\u4e32\u4e24\u7aef\u7684\u7a7a\u767d\u5b57\u7b26\uff0c\u7136\u540e\u518d\u8fdb\u884c\u5224\u65ad\u3002\u8fd9\u79cd\u65b9\u6cd5\u7279\u522b\u9002\u7528\u4e8e\u9700\u8981\u5904\u7406\u7528\u6237\u8f93\u5165\u7684\u60c5\u51b5\u3002<\/p>\n<\/p>\n<p><h3>1\u3001\u57fa\u672c\u7528\u6cd5<\/h3>\n<\/p>\n<p><p>\u57fa\u672c\u4f7f\u7528<code>strip()<\/code>\u65b9\u6cd5\u7684\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_string = &quot;  &quot;<\/p>\n<p>if my_string.strip() == &quot;&quot;:<\/p>\n<p>    print(&quot;The string is empty or contains only whitespace&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;The string is not empty&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code>strip()<\/code>\u65b9\u6cd5\u53bb\u9664\u4e86\u5b57\u7b26\u4e32<code>my_string<\/code>\u4e24\u7aef\u7684\u7a7a\u767d\u5b57\u7b26\uff0c\u7136\u540e\u518d\u8fdb\u884c\u6bd4\u8f83\u5224\u65ad\u3002<\/p>\n<\/p>\n<p><h3>2\u3001\u5904\u7406\u7528\u6237\u8f93\u5165<\/h3>\n<\/p>\n<p><p>\u8fd9\u79cd\u65b9\u6cd5\u5728\u5904\u7406\u7528\u6237\u8f93\u5165\u65f6\u7279\u522b\u6709\u7528\uff0c\u56e0\u4e3a\u7528\u6237\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u53ef\u80fd\u5305\u542b\u7a7a\u767d\u5b57\u7b26\uff0c\u901a\u8fc7<code>strip()<\/code>\u65b9\u6cd5\u53ef\u4ee5\u53bb\u9664\u8fd9\u4e9b\u7a7a\u767d\u5b57\u7b26\u7136\u540e\u518d\u8fdb\u884c\u5224\u65ad\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">user_input = input(&quot;Enter some text: &quot;)<\/p>\n<p>if user_input.strip() == &quot;&quot;:<\/p>\n<p>    print(&quot;You entered an empty string or only whitespace&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;You entered: &quot; + user_input)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u79cd\u65b9\u6cd5\u53ef\u4ee5\u6709\u6548\u9632\u6b62\u7528\u6237\u8f93\u5165\u7a7a\u767d\u5b57\u7b26\u800c\u5bfc\u81f4\u7684\u8bef\u5224\u3002<\/p>\n<\/p>\n<p><h2>\u56db\u3001\u4f7f\u7528not\u64cd\u4f5c\u7b26<\/h2>\n<\/p>\n<p><p>\u4f7f\u7528<code>not<\/code>\u64cd\u4f5c\u7b26\u4e5f\u662f\u4e00\u79cd\u7b80\u6d01\u7684\u65b9\u6cd5\uff0c\u901a\u8fc7\u5224\u65ad\u5b57\u7b26\u4e32\u662f\u5426\u4e3a\u5047\u503c\uff0c\u53ef\u4ee5\u5feb\u901f\u5224\u65ad\u5b57\u7b26\u4e32\u662f\u5426\u4e3a\u7a7a\u3002<\/p>\n<\/p>\n<p><h3>1\u3001\u57fa\u672c\u7528\u6cd5<\/h3>\n<\/p>\n<p><p>\u57fa\u672c\u4f7f\u7528<code>not<\/code>\u64cd\u4f5c\u7b26\u7684\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_string = &quot;&quot;<\/p>\n<p>if not my_string:<\/p>\n<p>    print(&quot;The string is empty&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;The string is not empty&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u7a7a\u5b57\u7b26\u4e32\u5728\u5e03\u5c14\u4e0a\u4e0b\u6587\u4e2d\u88ab\u89c6\u4e3a\u5047\u503c\uff0c\u56e0\u6b64<code>not my_string<\/code>\u4e3a\u771f\uff0c\u8868\u793a\u5b57\u7b26\u4e32\u4e3a\u7a7a\u3002<\/p>\n<\/p>\n<p><h3>2\u3001\u7ed3\u5408\u5176\u4ed6\u6761\u4ef6<\/h3>\n<\/p>\n<p><p>\u540c\u6837\uff0c\u6211\u4eec\u53ef\u4ee5\u7ed3\u5408<code>strip()<\/code>\u65b9\u6cd5\u4f7f\u7528<code>not<\/code>\u64cd\u4f5c\u7b26\uff0c\u4ee5\u5904\u7406\u5305\u542b\u7a7a\u767d\u5b57\u7b26\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">my_string = &quot;  &quot;<\/p>\n<p>if not my_string.strip():<\/p>\n<p>    print(&quot;The string is empty or contains only whitespace&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;The string is not empty&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u79cd\u65b9\u6cd5\u540c\u6837\u9002\u7528\u4e8e\u5904\u7406\u7528\u6237\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><h2>\u4e94\u3001\u603b\u7ed3<\/h2>\n<\/p>\n<p><p>\u7efc\u4e0a\u6240\u8ff0\uff0c<strong>\u5224\u65ad\u4e00\u4e2a\u5b57\u7b26\u4e32\u662f\u5426\u4e3a\u7a7a\u503c\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u4e3b\u8981\u5305\u62ec\u4f7f\u7528len()\u51fd\u6570\u3001\u76f4\u63a5\u6bd4\u8f83\u3001strip()\u65b9\u6cd5\u548cnot\u64cd\u4f5c\u7b26\u3002<\/strong> \u6bcf\u79cd\u65b9\u6cd5\u90fd\u6709\u5176\u9002\u7528\u7684\u573a\u666f\u548c\u4f18\u52bf\u3002\u4f7f\u7528<code>len()<\/code>\u51fd\u6570\u548c\u76f4\u63a5\u6bd4\u8f83\u662f\u6700\u4e3a\u5e38\u89c1\u548c\u76f4\u89c2\u7684\u65b9\u6cd5\uff0c\u800c\u7ed3\u5408<code>strip()<\/code>\u65b9\u6cd5\u53ef\u4ee5\u66f4\u597d\u5730\u5904\u7406\u7528\u6237\u8f93\u5165\u3002\u4f7f\u7528<code>not<\/code>\u64cd\u4f5c\u7b26\u5219\u63d0\u4f9b\u4e86\u4e00\u79cd\u7b80\u6d01\u7684\u8bed\u6cd5\u9009\u62e9\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u6765\u5224\u65ad\u5b57\u7b26\u4e32\u662f\u5426\u4e3a\u7a7a\u503c\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u68c0\u67e5\u5b57\u7b26\u4e32\u662f\u5426\u4e3a\u7a7a\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u7b80\u5355\u7684\u6761\u4ef6\u8bed\u53e5\u6765\u5224\u65ad\u4e00\u4e2a\u5b57\u7b26\u4e32\u662f\u5426\u4e3a\u7a7a\u3002\u6700\u5e38\u7528\u7684\u65b9\u6cd5\u662f\u76f4\u63a5\u4f7f\u7528if\u8bed\u53e5\u68c0\u67e5\u5b57\u7b26\u4e32\u7684\u771f\u5047\u503c\u3002\u4f8b\u5982\uff0c\u4f7f\u7528<code>if not my_string:<\/code>\u6765\u5224\u65ad<code>my_string<\/code>\u662f\u5426\u4e3a\u7a7a\u6216\u4e3aNone\u3002\u5982\u679c\u5b57\u7b26\u4e32\u4e3a\u7a7a\uff0c\u6761\u4ef6\u5c06\u8fd4\u56deTrue\u3002<\/p>\n<p><strong>\u7a7a\u5b57\u7b26\u4e32\u4e0eNone\u6709\u4ec0\u4e48\u533a\u522b\uff1f<\/strong><br \/>\u7a7a\u5b57\u7b26\u4e32\uff08&quot;&quot;\uff09\u662f\u4e00\u4e2a\u6709\u6548\u7684\u5b57\u7b26\u4e32\u7c7b\u578b\uff0c\u4f46\u4e0d\u5305\u542b\u4efb\u4f55\u5b57\u7b26\u3002\u800cNone\u5219\u8868\u793a\u4e00\u4e2a\u7a7a\u503c\u6216\u4e0d\u5b58\u5728\u7684\u5bf9\u8c61\u3002\u5728Python\u4e2d\uff0c\u4e24\u8005\u5728\u7528\u9014\u4e0a\u6709\u6240\u4e0d\u540c\uff0c\u901a\u5e38\u9700\u8981\u6839\u636e\u5177\u4f53\u60c5\u51b5\u9009\u62e9\u4f7f\u7528\u3002<\/p>\n<p><strong>\u5728Python\u4e2d\u5982\u4f55\u5904\u7406\u7a7a\u5b57\u7b26\u4e32\u7684\u60c5\u51b5\uff1f<\/strong><br \/>\u5904\u7406\u7a7a\u5b57\u7b26\u4e32\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u6761\u4ef6\u5224\u65ad\u6765\u907f\u514d\u9519\u8bef\u3002\u4f8b\u5982\uff0c\u5728\u8fdb\u884c\u5b57\u7b26\u4e32\u64cd\u4f5c\u4e4b\u524d\uff0c\u53ef\u4ee5\u5148\u68c0\u67e5\u5b57\u7b26\u4e32\u662f\u5426\u4e3a\u7a7a\uff0c\u5982\u679c\u4e3a\u7a7a\uff0c\u53ef\u4ee5\u9009\u62e9\u8fd4\u56de\u4e00\u4e2a\u9ed8\u8ba4\u503c\u6216\u629b\u51fa\u5f02\u5e38\uff0c\u4ee5\u786e\u4fdd\u7a0b\u5e8f\u7684\u7a33\u5b9a\u6027\u3002\u540c\u65f6\uff0c\u4f7f\u7528\u5b57\u7b26\u4e32\u7684<code>strip()<\/code>\u65b9\u6cd5\u53ef\u4ee5\u53bb\u9664\u7a7a\u767d\u5b57\u7b26\uff0c\u8fdb\u4e00\u6b65\u786e\u4fdd\u5b57\u7b26\u4e32\u662f\u6709\u6548\u7684\u3002<\/p>\n<p><strong>\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u662f\u5426\u53ef\u4ee5\u68c0\u67e5\u5b57\u7b26\u4e32\u662f\u5426\u4e3a\u7a7a\uff1f<\/strong><br \/>\u662f\u7684\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u53ef\u4ee5\u7528\u6765\u5224\u65ad\u5b57\u7b26\u4e32\u662f\u5426\u4e3a\u7a7a\u3002\u53ef\u4ee5\u4f7f\u7528<code>re<\/code>\u6a21\u5757\u4e2d\u7684<code>match<\/code>\u65b9\u6cd5\u6765\u5339\u914d\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff0c<code>re.match(r&#39;^\\s*$&#39;, my_string)<\/code>\u53ef\u4ee5\u7528\u4e8e\u68c0\u67e5\u5b57\u7b26\u4e32\u662f\u5426\u53ea\u5305\u542b\u7a7a\u767d\u5b57\u7b26\u3002\u5982\u679c\u5339\u914d\u6210\u529f\uff0c\u8bf4\u660e\u5b57\u7b26\u4e32\u4e3a\u7a7a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u5224\u65ad\u4e00\u4e2a\u5b57\u7b26\u4e32\u662f\u5426\u4e3a\u7a7a\u503c\u7684\u5e38\u89c1\u65b9\u6cd5\u6709\uff1a\u4f7f\u7528len()\u51fd\u6570\u3001\u4f7f\u7528\u76f4\u63a5\u6bd4\u8f83\u3001\u4f7f\u7528strip()\u65b9\u6cd5\u53bb\u9664 [&hellip;]","protected":false},"author":3,"featured_media":1146893,"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\/1146882"}],"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=1146882"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1146882\/revisions"}],"predecessor-version":[{"id":1146897,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1146882\/revisions\/1146897"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1146893"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1146882"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1146882"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1146882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}