{"id":1079771,"date":"2025-01-08T12:23:59","date_gmt":"2025-01-08T04:23:59","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1079771.html"},"modified":"2025-01-08T12:24:02","modified_gmt":"2025-01-08T04:24:02","slug":"python%e5%a6%82%e4%bd%95%e7%bb%93%e6%9d%9f%e4%b8%80%e4%b8%aa%e6%ad%bb%e5%be%aa%e7%8e%af-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1079771.html","title":{"rendered":"python\u5982\u4f55\u7ed3\u675f\u4e00\u4e2a\u6b7b\u5faa\u73af"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24182641\/720cee71-7108-49f1-a4a0-19ebea5d7ca7.webp\" alt=\"python\u5982\u4f55\u7ed3\u675f\u4e00\u4e2a\u6b7b\u5faa\u73af\" \/><\/p>\n<p><p> <strong>\u4f7f\u7528<code>break<\/code>\u8bed\u53e5\u3001\u4f7f\u7528<code>return<\/code>\u8bed\u53e5\u3001\u4f7f\u7528<code>sys.exit()<\/code>\u65b9\u6cd5<\/strong><\/p>\n<\/p>\n<p><p>\u8981\u7ed3\u675f\u4e00\u4e2aPython\u4e2d\u7684\u6b7b\u5faa\u73af\uff0c\u901a\u5e38\u6709\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\uff1a<strong>\u4f7f\u7528<code>break<\/code>\u8bed\u53e5<\/strong>\u3001<strong>\u4f7f\u7528<code>return<\/code>\u8bed\u53e5<\/strong>\u548c<strong>\u4f7f\u7528<code>sys.exit()<\/code>\u65b9\u6cd5<\/strong>\u3002\u5176\u4e2d\uff0c<code>break<\/code>\u8bed\u53e5\u662f\u6700\u5e38\u89c1\u548c\u76f4\u63a5\u7684\u65b9\u5f0f\u3002\u5f53\u5faa\u73af\u5185\u7684\u67d0\u4e2a\u6761\u4ef6\u88ab\u6ee1\u8db3\u65f6\uff0c\u4f7f\u7528<code>break<\/code>\u8bed\u53e5\u53ef\u4ee5\u7acb\u5373\u7ec8\u6b62\u5faa\u73af\u5e76\u8df3\u51fa\u5f53\u524d\u7684\u5faa\u73af\u4f53\u3002\u4e0b\u9762\u6211\u4eec\u5c06\u8be6\u7ec6\u8ba8\u8bba\u8fd9\u4e9b\u65b9\u6cd5\u4ee5\u53ca\u5b83\u4eec\u7684\u5177\u4f53\u5e94\u7528\u573a\u666f\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528<code>break<\/code>\u8bed\u53e5<\/h3>\n<\/p>\n<p><p><code>break<\/code>\u8bed\u53e5\u662f\u6700\u5e38\u7528\u7684\u65b9\u5f0f\u6765\u7ec8\u6b62\u4e00\u4e2a\u5faa\u73af\u3002\u5b83\u53ef\u4ee5\u4ece\u5faa\u73af\u4f53\u5185\u4efb\u4f55\u5730\u65b9\u7acb\u5373\u9000\u51fa\u5faa\u73af\uff0c\u4e0d\u518d\u6267\u884c\u5faa\u73af\u4f53\u5185\u7684\u5269\u4f59\u4ee3\u7801\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\uff1a<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">while True:<\/p>\n<p>    user_input = input(&quot;Enter &#39;exit&#39; to leave the loop: &quot;)<\/p>\n<p>    if user_input == &#39;exit&#39;:<\/p>\n<p>        break<\/p>\n<p>    print(&quot;You entered:&quot;, user_input)<\/p>\n<p>print(&quot;Loop has been terminated.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u5faa\u73af\u4f1a\u4e00\u76f4\u8fd0\u884c\u76f4\u5230\u7528\u6237\u8f93\u5165&#39;exit&#39;\uff0c\u8fd9\u65f6<code>break<\/code>\u8bed\u53e5\u4f1a\u7ec8\u6b62\u5faa\u73af\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528<code>return<\/code>\u8bed\u53e5<\/h3>\n<\/p>\n<p><p>\u5728\u51fd\u6570\u5185\u90e8\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528<code>return<\/code>\u8bed\u53e5\u6765\u7ed3\u675f\u4e00\u4e2a\u5faa\u73af\u4ee5\u53ca\u6574\u4e2a\u51fd\u6570\u7684\u6267\u884c\u3002\u5f53<code>return<\/code>\u8bed\u53e5\u88ab\u6267\u884c\u65f6\uff0c\u51fd\u6570\u5c06\u7acb\u5373\u7ec8\u6b62\u5e76\u8fd4\u56de\u6307\u5b9a\u7684\u503c\uff08\u5982\u679c\u6709\uff09\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\uff1a<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">def infinite_loop():<\/p>\n<p>    while True:<\/p>\n<p>        user_input = input(&quot;Enter &#39;exit&#39; to leave the loop: &quot;)<\/p>\n<p>        if user_input == &#39;exit&#39;:<\/p>\n<p>            return<\/p>\n<p>        print(&quot;You entered:&quot;, user_input)<\/p>\n<p>    print(&quot;This will never be printed&quot;)<\/p>\n<p>infinite_loop()<\/p>\n<p>print(&quot;Function has returned.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code>return<\/code>\u8bed\u53e5\u4e0d\u4ec5\u7ec8\u6b62\u4e86\u5faa\u73af\uff0c\u8fd8\u7ec8\u6b62\u4e86\u6574\u4e2a\u51fd\u6570\u7684\u6267\u884c\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528<code>sys.exit()<\/code>\u65b9\u6cd5<\/h3>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u4f60\u53ef\u80fd\u5e0c\u671b\u7acb\u5373\u7ec8\u6b62\u6574\u4e2a\u7a0b\u5e8f\u7684\u6267\u884c\u3002<code>sys.exit()<\/code>\u65b9\u6cd5\u53ef\u4ee5\u7528\u6765\u5b9e\u73b0\u8fd9\u4e2a\u529f\u80fd\u3002\u8fd9\u4e2a\u65b9\u6cd5\u4f1a\u629b\u51fa\u4e00\u4e2a<code>SystemExit<\/code>\u5f02\u5e38\uff0c\u4ece\u800c\u7ec8\u6b62\u7a0b\u5e8f\u7684\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\uff1a<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import sys<\/p>\n<p>while True:<\/p>\n<p>    user_input = input(&quot;Enter &#39;exit&#39; to terminate the program: &quot;)<\/p>\n<p>    if user_input == &#39;exit&#39;:<\/p>\n<p>        sys.exit()<\/p>\n<p>    print(&quot;You entered:&quot;, user_input)<\/p>\n<p>print(&quot;This will never be printed.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code>sys.exit()<\/code>\u65b9\u6cd5\u4f1a\u7acb\u5373\u7ec8\u6b62\u6574\u4e2a\u7a0b\u5e8f\u7684\u6267\u884c\uff0c\u5e76\u4e14\u540e\u7eed\u7684\u4ee3\u7801\u5c06\u4e0d\u4f1a\u88ab\u6267\u884c\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u4f7f\u7528\u5e03\u5c14\u53d8\u91cf\u63a7\u5236\u5faa\u73af<\/h3>\n<\/p>\n<p><p>\u53e6\u4e00\u79cd\u5e38\u89c1\u7684\u65b9\u6cd5\u662f\u4f7f\u7528\u5e03\u5c14\u53d8\u91cf\u6765\u63a7\u5236\u5faa\u73af\u7684\u6267\u884c\u3002\u8fd9\u79cd\u65b9\u6cd5\u901a\u5e38\u7528\u4e8e\u590d\u6742\u7684\u6761\u4ef6\u63a7\u5236\u4e2d\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\uff1a<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">running = True<\/p>\n<p>while running:<\/p>\n<p>    user_input = input(&quot;Enter &#39;exit&#39; to stop the loop: &quot;)<\/p>\n<p>    if user_input == &#39;exit&#39;:<\/p>\n<p>        running = False<\/p>\n<p>    else:<\/p>\n<p>        print(&quot;You entered:&quot;, user_input)<\/p>\n<p>print(&quot;Loop has been stopped.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u901a\u8fc7\u8bbe\u7f6e\u5e03\u5c14\u53d8\u91cf<code>running<\/code>\u7684\u503c\u6765\u63a7\u5236\u5faa\u73af\u7684\u6267\u884c\u3002\u5f53\u7528\u6237\u8f93\u5165&#39;exit&#39;\u65f6\uff0c<code>running<\/code>\u88ab\u8bbe\u7f6e\u4e3a<code>False<\/code>\uff0c\u5faa\u73af\u7ec8\u6b62\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u4f7f\u7528\u5f02\u5e38\u5904\u7406\u673a\u5236<\/h3>\n<\/p>\n<p><p>\u6709\u65f6\u4f60\u53ef\u80fd\u9700\u8981\u4f7f\u7528\u5f02\u5e38\u5904\u7406\u673a\u5236\u6765\u7ec8\u6b62\u5faa\u73af\u3002\u901a\u8fc7\u629b\u51fa\u5e76\u6355\u83b7\u5f02\u5e38\uff0c\u4f60\u53ef\u4ee5\u5b9e\u73b0\u66f4\u590d\u6742\u7684\u63a7\u5236\u6d41\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\uff1a<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">class LoopTerminationException(Exception):<\/p>\n<p>    pass<\/p>\n<p>try:<\/p>\n<p>    while True:<\/p>\n<p>        user_input = input(&quot;Enter &#39;exit&#39; to throw an exception and stop the loop: &quot;)<\/p>\n<p>        if user_input == &#39;exit&#39;:<\/p>\n<p>            r<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>se LoopTerminationException<\/p>\n<p>        print(&quot;You entered:&quot;, user_input)<\/p>\n<p>except LoopTerminationException:<\/p>\n<p>    print(&quot;Loop has been terminated by raising an exception.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u901a\u8fc7\u629b\u51fa<code>LoopTerminationException<\/code>\u5f02\u5e38\u6765\u7ec8\u6b62\u5faa\u73af\uff0c\u5e76\u5728<code>except<\/code>\u5757\u4e2d\u6355\u83b7\u5f02\u5e38\uff0c\u4ece\u800c\u5b9e\u73b0\u5bf9\u5faa\u73af\u7684\u63a7\u5236\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u4f7f\u7528\u591a\u7ebf\u7a0b\u4e2d\u7684\u7ebf\u7a0b\u7ec8\u6b62<\/h3>\n<\/p>\n<p><p>\u5728\u591a\u7ebf\u7a0b\u7f16\u7a0b\u4e2d\uff0c\u5982\u679c\u4f60\u9700\u8981\u7ec8\u6b62\u4e00\u4e2a\u7ebf\u7a0b\u4e2d\u7684\u6b7b\u5faa\u73af\uff0c\u53ef\u4ee5\u4f7f\u7528\u7ebf\u7a0b\u7684\u7ec8\u6b62\u6807\u5fd7\u6216\u8005\u5176\u4ed6\u540c\u6b65\u673a\u5236\u6765\u5b9e\u73b0\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\uff1a<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import threading<\/p>\n<p>import time<\/p>\n<p>class StoppableThread(threading.Thread):<\/p>\n<p>    def __init__(self):<\/p>\n<p>        super().__init__()<\/p>\n<p>        self._stop_event = threading.Event()<\/p>\n<p>    def run(self):<\/p>\n<p>        while not self._stop_event.is_set():<\/p>\n<p>            print(&quot;Thread is running...&quot;)<\/p>\n<p>            time.sleep(1)<\/p>\n<p>    def stop(self):<\/p>\n<p>        self._stop_event.set()<\/p>\n<p>thread = StoppableThread()<\/p>\n<p>thread.start()<\/p>\n<p>time.sleep(5)<\/p>\n<p>thread.stop()<\/p>\n<p>thread.join()<\/p>\n<p>print(&quot;Thread has been stopped.&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u901a\u8fc7\u8bbe\u7f6e\u7ebf\u7a0b\u7684\u7ec8\u6b62\u6807\u5fd7<code>_stop_event<\/code>\u6765\u63a7\u5236\u7ebf\u7a0b\u4e2d\u7684\u6b7b\u5faa\u73af\u3002\u5728\u4e3b\u7ebf\u7a0b\u4e2d\u8c03\u7528<code>stop()<\/code>\u65b9\u6cd5\u6765\u7ec8\u6b62\u5b50\u7ebf\u7a0b\u7684\u6267\u884c\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u4f7f\u7528\u4fe1\u53f7\u5904\u7406\u673a\u5236<\/h3>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u9ad8\u7ea7\u5e94\u7528\u4e2d\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u4f7f\u7528\u4fe1\u53f7\u5904\u7406\u673a\u5236\u6765\u7ec8\u6b62\u5faa\u73af\u3002\u4f8b\u5982\uff0c\u5728\u5904\u7406Unix\u4fe1\u53f7\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code>signal<\/code>\u6a21\u5757\u6765\u5b9e\u73b0\u8fd9\u4e00\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><h4>\u793a\u4f8b\uff1a<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import signal<\/p>\n<p>import sys<\/p>\n<p>def signal_handler(sig, frame):<\/p>\n<p>    print(&#39;Signal received, terminating the loop...&#39;)<\/p>\n<p>    sys.exit(0)<\/p>\n<p>signal.signal(signal.SIGINT, signal_handler)<\/p>\n<p>while True:<\/p>\n<p>    print(&#39;Running... Press Ctrl+C to stop.&#39;)<\/p>\n<p>    time.sleep(1)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u901a\u8fc7\u6355\u83b7<code>SIGINT<\/code>\u4fe1\u53f7\uff08\u901a\u5e38\u7531Ctrl+C\u53d1\u51fa\uff09\u6765\u7ec8\u6b62\u5faa\u73af\u3002<code>signal_handler<\/code>\u51fd\u6570\u4f1a\u5728\u63a5\u6536\u5230\u4fe1\u53f7\u65f6\u88ab\u8c03\u7528\uff0c\u4ece\u800c\u7ec8\u6b62\u7a0b\u5e8f\u7684\u6267\u884c\u3002<\/p>\n<\/p>\n<p><h3>\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u8be6\u7ec6\u8ba8\u8bba\u4e86\u591a\u79cd\u7ec8\u6b62Python\u6b7b\u5faa\u73af\u7684\u65b9\u6cd5\uff0c\u5305\u62ec<code>break<\/code>\u8bed\u53e5\u3001<code>return<\/code>\u8bed\u53e5\u3001<code>sys.exit()<\/code>\u65b9\u6cd5\u3001\u5e03\u5c14\u53d8\u91cf\u63a7\u5236\u3001\u5f02\u5e38\u5904\u7406\u3001\u591a\u7ebf\u7a0b\u4e2d\u7684\u7ebf\u7a0b\u7ec8\u6b62\u4ee5\u53ca\u4fe1\u53f7\u5904\u7406\u673a\u5236\u3002\u6bcf\u79cd\u65b9\u6cd5\u90fd\u6709\u5176\u9002\u7528\u7684\u573a\u666f\u548c\u4f18\u7f3a\u70b9\uff0c\u5177\u4f53\u9009\u62e9\u54ea\u79cd\u65b9\u6cd5\u53d6\u51b3\u4e8e\u4f60\u7684\u5e94\u7528\u9700\u6c42\u548c\u4ee3\u7801\u7ed3\u6784\u3002<\/p>\n<\/p>\n<p><p>\u65e0\u8bba\u9009\u62e9\u54ea\u79cd\u65b9\u6cd5\uff0c\u786e\u4fdd\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002\u5e0c\u671b\u8fd9\u4e9b\u793a\u4f8b\u548c\u89e3\u91ca\u80fd\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u7406\u89e3\u5982\u4f55\u5728Python\u4e2d\u7ec8\u6b62\u6b7b\u5faa\u73af\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5224\u65ad\u4e00\u4e2aPython\u7a0b\u5e8f\u662f\u5426\u8fdb\u5165\u4e86\u6b7b\u5faa\u73af\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u6b7b\u5faa\u73af\u901a\u5e38\u6307\u7684\u662f\u4e00\u4e2a\u5faa\u73af\u5728\u6ca1\u6709\u6ee1\u8db3\u9000\u51fa\u6761\u4ef6\u7684\u60c5\u51b5\u4e0b\u6301\u7eed\u8fd0\u884c\u3002\u5224\u65ad\u7a0b\u5e8f\u662f\u5426\u8fdb\u5165\u6b7b\u5faa\u73af\u53ef\u4ee5\u901a\u8fc7\u89c2\u5bdfCPU\u4f7f\u7528\u7387\uff0c\u67e5\u770b\u7a0b\u5e8f\u662f\u5426\u54cd\u5e94\uff0c\u6216\u8005\u5728\u4ee3\u7801\u4e2d\u52a0\u5165\u65e5\u5fd7\u8f93\u51fa\uff0c\u76d1\u63a7\u5faa\u73af\u7684\u6267\u884c\u60c5\u51b5\u3002\u5982\u679c\u53d1\u73b0\u5faa\u73af\u4e2d\u7684\u6761\u4ef6\u6ca1\u6709\u53d8\u5316\u6216\u8005\u8f93\u51fa\u7ed3\u679c\u957f\u65f6\u95f4\u4e0d\u53d8\uff0c\u5f88\u53ef\u80fd\u5c31\u662f\u6b7b\u5faa\u73af\u3002<\/p>\n<p><strong>\u6709\u54ea\u4e9b\u65b9\u6cd5\u53ef\u4ee5\u5b89\u5168\u5730\u7ed3\u675f\u4e00\u4e2a\u6b7b\u5faa\u73af\uff1f<\/strong><br \/>\u7ed3\u675f\u6b7b\u5faa\u73af\u6709\u591a\u79cd\u65b9\u6cd5\u3002\u4e00\u79cd\u5e38\u7528\u7684\u65b9\u6cd5\u662f\u4f7f\u7528\u952e\u76d8\u4e2d\u65ad\uff0c\u4f8b\u5982\u5728\u547d\u4ee4\u884c\u4e2d\u6309\u4e0b<code>Ctrl+C<\/code>\uff0c\u8fd9\u4f1a\u5f15\u53d1<code>KeyboardInterrupt<\/code>\u5f02\u5e38\uff0c\u4ece\u800c\u7ec8\u6b62\u7a0b\u5e8f\u3002\u5982\u679c\u9700\u8981\u5728\u4ee3\u7801\u4e2d\u4f18\u96c5\u5730\u7ed3\u675f\u5faa\u73af\uff0c\u53ef\u4ee5\u8003\u8651\u52a0\u5165\u4e00\u4e2a\u6761\u4ef6\u53d8\u91cf\u6216\u8005\u4f7f\u7528<code>break<\/code>\u8bed\u53e5\uff0c\u786e\u4fdd\u5728\u9002\u5f53\u7684\u6761\u4ef6\u4e0b\u8df3\u51fa\u5faa\u73af\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Python\u4e2d\u4f7f\u7528\u5f02\u5e38\u5904\u7406\u6765\u907f\u514d\u6b7b\u5faa\u73af\uff1f<\/strong><br \/>\u901a\u8fc7\u5728\u5faa\u73af\u4e2d\u52a0\u5165\u5f02\u5e38\u5904\u7406\uff0c\u53ef\u4ee5\u6709\u6548\u907f\u514d\u6b7b\u5faa\u73af\u7684\u5f71\u54cd\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528<code>try...except<\/code>\u8bed\u53e5\u6765\u6355\u83b7\u7279\u5b9a\u7684\u5f02\u5e38\uff0c\u5f53\u68c0\u6d4b\u5230\u5f02\u5e38\u540e\uff0c\u53ef\u4ee5\u9009\u62e9\u9000\u51fa\u5faa\u73af\u6216\u8fdb\u884c\u5176\u4ed6\u5904\u7406\u3002\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u5728\u9047\u5230\u610f\u5916\u60c5\u51b5\u65f6\uff0c\u786e\u4fdd\u7a0b\u5e8f\u80fd\u591f\u5b89\u5168\u9000\u51fa\uff0c\u800c\u4e0d\u662f\u65e0\u9650\u5236\u5730\u8fd0\u884c\u4e0b\u53bb\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u4f7f\u7528break\u8bed\u53e5\u3001\u4f7f\u7528return\u8bed\u53e5\u3001\u4f7f\u7528sys.exit()\u65b9\u6cd5 \u8981\u7ed3\u675f\u4e00\u4e2aPython\u4e2d\u7684\u6b7b\u5faa\u73af\uff0c\u901a\u5e38 [&hellip;]","protected":false},"author":3,"featured_media":1079785,"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\/1079771"}],"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=1079771"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1079771\/revisions"}],"predecessor-version":[{"id":1079788,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1079771\/revisions\/1079788"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1079785"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1079771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1079771"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1079771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}