{"id":1158525,"date":"2025-01-13T18:41:44","date_gmt":"2025-01-13T10:41:44","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1158525.html"},"modified":"2025-01-13T18:41:46","modified_gmt":"2025-01-13T10:41:46","slug":"%e5%a6%82%e4%bd%95%e6%8e%a7%e5%88%b6python%e6%89%93%e5%8d%b0%e6%8d%a2%e8%a1%8c","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1158525.html","title":{"rendered":"\u5982\u4f55\u63a7\u5236python\u6253\u5370\u6362\u884c"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25200454\/37262784-63c7-42d1-b935-0f3297be805c.webp\" alt=\"\u5982\u4f55\u63a7\u5236python\u6253\u5370\u6362\u884c\" \/><\/p>\n<p><p> \u8981\u63a7\u5236Python\u6253\u5370\u6362\u884c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e9b\u6280\u5de7\u548c\u65b9\u6cd5\uff0c\u5305\u62ec<strong>\u4f7f\u7528end\u53c2\u6570\u3001\u4f7f\u7528\u8f6c\u4e49\u5b57\u7b26\u3001\u5b57\u7b26\u4e32\u8fde\u63a5<\/strong>\u7b49\u3002\u4e0b\u9762\u6211\u4eec\u8be6\u7ec6\u63a2\u8ba8\u5176\u4e2d\u7684\u4e00\u70b9\uff1a<strong>\u4f7f\u7528end\u53c2\u6570<\/strong>\u3002\u5728Python\u4e2d\uff0cprint()\u51fd\u6570\u9ed8\u8ba4\u4f1a\u5728\u8f93\u51fa\u7684\u672b\u5c3e\u6dfb\u52a0\u4e00\u4e2a\u6362\u884c\u7b26\uff0c\u4f7f\u5f97\u6bcf\u6b21print()\u8c03\u7528\u540e\u8f93\u51fa\u5185\u5bb9\u4f1a\u6362\u884c\u3002\u5982\u679c\u6211\u4eec\u4e0d\u60f3\u6362\u884c\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6eend\u53c2\u6570\u6765\u6539\u53d8\u8fd9\u4e2a\u9ed8\u8ba4\u884c\u4e3a\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(&quot;Hello&quot;, end=&quot;&quot;)<\/p>\n<p>print(&quot;World&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u5c06\u4f1a\u8f93\u51fa &quot;HelloWorld&quot; \u800c\u4e0d\u662f &quot;Hello\\nWorld&quot;\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528end\u53c2\u6570<\/h3>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0cprint()\u51fd\u6570\u9ed8\u8ba4\u4f1a\u5728\u8f93\u51fa\u5185\u5bb9\u7684\u672b\u5c3e\u6dfb\u52a0\u6362\u884c\u7b26\uff0c\u4f7f\u5f97\u6bcf\u6b21\u8c03\u7528print()\u65f6\uff0c\u8f93\u51fa\u4f1a\u81ea\u52a8\u6362\u884c\u3002\u4e3a\u4e86\u63a7\u5236\u8fd9\u4e00\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528end\u53c2\u6570\u6765\u6307\u5b9a\u8f93\u51fa\u5185\u5bb9\u7684\u7ed3\u5c3e\u5b57\u7b26\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(&quot;Hello&quot;, end=&quot;, &quot;)<\/p>\n<p>print(&quot;World&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u5c06\u4f1a\u8f93\u51fa &quot;Hello, World&quot;\uff0c\u800c\u4e0d\u662f\u9ed8\u8ba4\u7684\u6362\u884c\u8f93\u51fa\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u5982\u4f55\u4f7f\u7528end\u53c2\u6570<\/h4>\n<\/p>\n<p><p>end\u53c2\u6570\u7684\u9ed8\u8ba4\u503c\u662f\u6362\u884c\u7b26&#39;\\n&#39;\uff0c\u53ef\u4ee5\u5c06\u5176\u6539\u4e3a\u4efb\u4f55\u5b57\u7b26\u4e32\uff0c\u6bd4\u5982\u7a7a\u5b57\u7b26\u4e32\u3001\u7a7a\u683c\u3001\u9017\u53f7\u7b49\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u4f8b\u5b50\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u4f7f\u7528\u7a7a\u5b57\u7b26\u4e32<\/p>\n<p>print(&quot;Hello&quot;, end=&quot;&quot;)<\/p>\n<p>print(&quot;World&quot;)<\/p>\n<h2><strong>\u4f7f\u7528\u7a7a\u683c<\/strong><\/h2>\n<p>print(&quot;Hello&quot;, end=&quot; &quot;)<\/p>\n<p>print(&quot;World&quot;)<\/p>\n<h2><strong>\u4f7f\u7528\u9017\u53f7\u548c\u7a7a\u683c<\/strong><\/h2>\n<p>print(&quot;Hello&quot;, end=&quot;, &quot;)<\/p>\n<p>print(&quot;World&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e9b\u8bbe\u7f6e\u53ef\u4ee5\u5b9e\u73b0\u4e0d\u540c\u7684\u8f93\u51fa\u683c\u5f0f\uff0c\u6ee1\u8db3\u5404\u79cd\u9700\u6c42\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528\u8f6c\u4e49\u5b57\u7b26<\/h3>\n<\/p>\n<p><p>\u9664\u4e86\u4f7f\u7528end\u53c2\u6570\uff0c\u8f6c\u4e49\u5b57\u7b26\u4e5f\u662f\u63a7\u5236\u6253\u5370\u6362\u884c\u7684\u91cd\u8981\u5de5\u5177\u3002\u5e38\u89c1\u7684\u8f6c\u4e49\u5b57\u7b26\u6709&#39;\\n&#39;\uff08\u6362\u884c\uff09\u3001&#39;\\t&#39;\uff08\u5236\u8868\u7b26\uff09\u3001&#39;\\r&#39;\uff08\u56de\u8f66\uff09\u7b49\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u6362\u884c\u7b26\\n<\/h4>\n<\/p>\n<p><p>\u6362\u884c\u7b26\\n\u662f\u6700\u5e38\u89c1\u7684\u8f6c\u4e49\u5b57\u7b26\uff0c\u5b83\u53ef\u4ee5\u5c06\u8f93\u51fa\u5185\u5bb9\u6362\u884c\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(&quot;Hello\\nWorld&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u4f1a\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code>Hello<\/p>\n<p>World<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u5236\u8868\u7b26\\t<\/h4>\n<\/p>\n<p><p>\u5236\u8868\u7b26\\t\u7528\u4e8e\u5728\u8f93\u51fa\u5185\u5bb9\u4e2d\u6dfb\u52a0\u6c34\u5e73\u5236\u8868\u7b26\uff0c\u4f7f\u5f97\u8f93\u51fa\u5185\u5bb9\u5bf9\u9f50\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(&quot;Hello\\tWorld&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u4f1a\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code>Hello   World<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u5b57\u7b26\u4e32\u8fde\u63a5<\/h3>\n<\/p>\n<p><p>\u5b57\u7b26\u4e32\u8fde\u63a5\u4e5f\u662f\u63a7\u5236\u6253\u5370\u6362\u884c\u7684\u6709\u6548\u65b9\u6cd5\u3002\u53ef\u4ee5\u901a\u8fc7\u5c06\u591a\u4e2a\u5b57\u7b26\u4e32\u8fde\u63a5\u6210\u4e00\u4e2a\u5b57\u7b26\u4e32\u6765\u63a7\u5236\u8f93\u51fa\u683c\u5f0f\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u4f7f\u7528\u52a0\u53f7\u8fde\u63a5<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528\u52a0\u53f7\uff08+\uff09\u8fde\u63a5\u591a\u4e2a\u5b57\u7b26\u4e32\uff0c\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(&quot;Hello&quot; + &quot; &quot; + &quot;World&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u4f1a\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code>Hello World<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u4f7f\u7528\u683c\u5f0f\u5316\u5b57\u7b26\u4e32<\/h4>\n<\/p>\n<p><p>\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\u63d0\u4f9b\u4e86\u66f4\u4e3a\u7075\u6d3b\u7684\u5b57\u7b26\u4e32\u8fde\u63a5\u65b9\u6cd5\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">name = &quot;World&quot;<\/p>\n<p>print(f&quot;Hello {name}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u4f1a\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code>Hello World<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u7ed3\u5408\u4f7f\u7528\u591a\u79cd\u65b9\u6cd5<\/h3>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u53ef\u4ee5\u7ed3\u5408\u4f7f\u7528\u591a\u79cd\u65b9\u6cd5\u6765\u5b9e\u73b0\u66f4\u4e3a\u590d\u6742\u7684\u8f93\u51fa\u683c\u5f0f\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">name = &quot;World&quot;<\/p>\n<p>print(&quot;Hello&quot;, end=&quot;, &quot;)<\/p>\n<p>print(f&quot;{name}\\nWelcome to Python programming!&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u4f1a\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code>Hello, World<\/p>\n<p>Welcome to Python programming!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u7ed3\u5408\u4f7f\u7528end\u53c2\u6570\u3001\u8f6c\u4e49\u5b57\u7b26\u548c\u5b57\u7b26\u4e32\u8fde\u63a5\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5bf9\u8f93\u51fa\u5185\u5bb9\u7684\u7cbe\u7ec6\u63a7\u5236\uff0c\u6ee1\u8db3\u5404\u79cd\u590d\u6742\u7684\u8f93\u51fa\u9700\u6c42\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u5b9e\u9645\u5e94\u7528\u573a\u666f<\/h3>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u7f16\u7a0b\u4e2d\uff0c\u63a7\u5236\u6253\u5370\u6362\u884c\u7684\u9700\u6c42\u975e\u5e38\u5e38\u89c1\u3002\u4f8b\u5982\uff0c\u5728\u6570\u636e\u5904\u7406\u3001\u65e5\u5fd7\u8bb0\u5f55\u3001\u7528\u6237\u4ea4\u4e92\u754c\u9762\u7b49\u573a\u666f\u4e2d\uff0c\u5408\u7406\u63a7\u5236\u8f93\u51fa\u683c\u5f0f\u53ef\u4ee5\u63d0\u9ad8\u7a0b\u5e8f\u7684\u53ef\u8bfb\u6027\u548c\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u6570\u636e\u5904\u7406<\/h4>\n<\/p>\n<p><p>\u5728\u6570\u636e\u5904\u7406\u8fc7\u7a0b\u4e2d\uff0c\u5e38\u5e38\u9700\u8981\u5c06\u5904\u7406\u7ed3\u679c\u4ee5\u7279\u5b9a\u683c\u5f0f\u8f93\u51fa\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data = [1, 2, 3, 4, 5]<\/p>\n<p>for i in data:<\/p>\n<p>    print(i, end=&quot;, &quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u4f1a\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code>1, 2, 3, 4, 5,<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u65e5\u5fd7\u8bb0\u5f55<\/h4>\n<\/p>\n<p><p>\u5728\u65e5\u5fd7\u8bb0\u5f55\u4e2d\uff0c\u5408\u7406\u63a7\u5236\u8f93\u51fa\u683c\u5f0f\u53ef\u4ee5\u63d0\u9ad8\u65e5\u5fd7\u7684\u53ef\u8bfb\u6027\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import logging<\/p>\n<p>logging.basicConfig(level=logging.INFO)<\/p>\n<p>logging.info(&quot;Start processing&quot;)<\/p>\n<p>logging.info(&quot;Processing data&quot;)<\/p>\n<p>logging.info(&quot;End processing&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u4f1a\u8f93\u51fa\uff1a<\/p>\n<\/p>\n<p><pre><code>INFO:root:Start processing<\/p>\n<p>INFO:root:Processing data<\/p>\n<p>INFO:root:End processing<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u5408\u7406\u63a7\u5236\u8f93\u51fa\u683c\u5f0f\uff0c\u53ef\u4ee5\u6e05\u6670\u5730\u8bb0\u5f55\u7a0b\u5e8f\u7684\u8fd0\u884c\u72b6\u6001\u548c\u5904\u7406\u8fc7\u7a0b\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u6ce8\u610f\u4e8b\u9879<\/h3>\n<\/p>\n<p><p>\u5728\u63a7\u5236\u6253\u5370\u6362\u884c\u65f6\uff0c\u9700\u8981\u6ce8\u610f\u4ee5\u4e0b\u51e0\u70b9\uff1a<\/p>\n<\/p>\n<p><h4>1\u3001\u907f\u514d\u8fc7\u5ea6\u4f7f\u7528end\u53c2\u6570<\/h4>\n<\/p>\n<p><p>\u867d\u7136end\u53c2\u6570\u53ef\u4ee5\u7075\u6d3b\u63a7\u5236\u8f93\u51fa\u683c\u5f0f\uff0c\u4f46\u8fc7\u5ea6\u4f7f\u7528\u53ef\u80fd\u5bfc\u81f4\u4ee3\u7801\u96be\u4ee5\u7ef4\u62a4\u3002\u5efa\u8bae\u5728\u5fc5\u8981\u65f6\u4f7f\u7528end\u53c2\u6570\uff0c\u800c\u4e0d\u662f\u6ee5\u7528\u3002<\/p>\n<\/p>\n<p><h4>2\u3001\u6ce8\u610f\u8f6c\u4e49\u5b57\u7b26\u7684\u4f7f\u7528<\/h4>\n<\/p>\n<p><p>\u8f6c\u4e49\u5b57\u7b26\u867d\u7136\u5f3a\u5927\uff0c\u4f46\u5bb9\u6613\u5bfc\u81f4\u4ee3\u7801\u53ef\u8bfb\u6027\u4e0b\u964d\u3002\u5728\u4f7f\u7528\u8f6c\u4e49\u5b57\u7b26\u65f6\uff0c\u5efa\u8bae\u6ce8\u91ca\u6e05\u6670\uff0c\u907f\u514d\u6df7\u6dc6\u3002<\/p>\n<\/p>\n<p><h4>3\u3001\u9009\u62e9\u5408\u9002\u7684\u5b57\u7b26\u4e32\u8fde\u63a5\u65b9\u6cd5<\/h4>\n<\/p>\n<p><p>\u4e0d\u540c\u7684\u5b57\u7b26\u4e32\u8fde\u63a5\u65b9\u6cd5\u5404\u6709\u4f18\u7f3a\u70b9\u3002\u5728\u9009\u62e9\u65f6\uff0c\u5efa\u8bae\u6839\u636e\u5177\u4f53\u9700\u6c42\u548c\u4ee3\u7801\u98ce\u683c\u8fdb\u884c\u9009\u62e9\u3002\u4f8b\u5982\uff0c\u5728\u9700\u8981\u52a8\u6001\u63d2\u5165\u53d8\u91cf\u65f6\uff0c\u53ef\u4ee5\u4f18\u5148\u8003\u8651\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<p><h3>\u4e03\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u63a7\u5236Python\u6253\u5370\u6362\u884c\u662f\u7f16\u7a0b\u4e2d\u5e38\u89c1\u7684\u9700\u6c42\uff0c\u901a\u8fc7<strong>\u4f7f\u7528end\u53c2\u6570\u3001\u4f7f\u7528\u8f6c\u4e49\u5b57\u7b26\u3001\u5b57\u7b26\u4e32\u8fde\u63a5<\/strong>\u7b49\u65b9\u6cd5\uff0c\u53ef\u4ee5\u7075\u6d3b\u63a7\u5236\u8f93\u51fa\u683c\u5f0f\uff0c\u6ee1\u8db3\u5404\u79cd\u9700\u6c42\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u5408\u7406\u63a7\u5236\u8f93\u51fa\u683c\u5f0f\u53ef\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u7528\u6237\u4f53\u9a8c\u3002\u5e0c\u671b\u901a\u8fc7\u672c\u6587\u7684\u4ecb\u7ecd\uff0c\u8bfb\u8005\u80fd\u591f\u638c\u63e1\u63a7\u5236Python\u6253\u5370\u6362\u884c\u7684\u65b9\u6cd5\u548c\u6280\u5de7\uff0c\u63d0\u5347\u7f16\u7a0b\u6c34\u5e73\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u5b9e\u73b0\u4e0d\u6362\u884c\u7684\u6253\u5370\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u5982\u679c\u5e0c\u671b\u5728\u6253\u5370\u5185\u5bb9\u65f6\u4e0d\u81ea\u52a8\u6362\u884c\uff0c\u53ef\u4ee5\u4f7f\u7528<code>print()<\/code>\u51fd\u6570\u7684<code>end<\/code>\u53c2\u6570\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code>print()<\/code>\u5728\u8f93\u51fa\u5185\u5bb9\u540e\u4f1a\u6dfb\u52a0\u6362\u884c\u7b26<code>\\n<\/code>\uff0c\u4f46\u901a\u8fc7\u8bbe\u7f6e<code>end=&#39;&#39;<\/code>\uff0c\u53ef\u4ee5\u66f4\u6539\u8fd9\u4e00\u884c\u4e3a\u3002\u4f8b\u5982\uff1a  <\/p>\n<pre><code class=\"language-python\">print(&quot;Hello&quot;, end=&#39;&#39;)\nprint(&quot; World&quot;)\n<\/code><\/pre>\n<p>\u4e0a\u8ff0\u4ee3\u7801\u5c06\u8f93\u51fa<code>Hello World<\/code>\u800c\u4e0d\u6362\u884c\u3002<\/p>\n<p><strong>\u5728Python\u4e2d\u5982\u4f55\u81ea\u5b9a\u4e49\u6362\u884c\u7b26\uff1f<\/strong><br \/>\u60a8\u53ef\u4ee5\u901a\u8fc7<code>print()<\/code>\u51fd\u6570\u7684<code>end<\/code>\u53c2\u6570\u81ea\u5b9a\u4e49\u6362\u884c\u7b26\u3002\u4f8b\u5982\uff0c\u5982\u679c\u5e0c\u671b\u5728\u6bcf\u6b21\u6253\u5370\u540e\u6dfb\u52a0\u4e00\u4e2a\u7a7a\u683c\u800c\u4e0d\u662f\u6362\u884c\uff0c\u53ef\u4ee5\u8fd9\u6837\u505a\uff1a  <\/p>\n<pre><code class=\"language-python\">print(&quot;Hello&quot;, end=&#39; &#39;)\nprint(&quot;World&quot;)\n<\/code><\/pre>\n<p>\u8fd9\u5c06\u4f7f\u8f93\u51fa\u7ed3\u679c\u4e3a<code>Hello World<\/code>\uff0c\u800c\u4e0d\u662f\u6362\u884c\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728\u5faa\u73af\u4e2d\u63a7\u5236\u6253\u5370\u7684\u6362\u884c\u884c\u4e3a\uff1f<\/strong><br \/>\u5728\u5faa\u73af\u4e2d\uff0c\u60a8\u53ef\u4ee5\u7075\u6d3b\u4f7f\u7528<code>print()<\/code>\u7684<code>end<\/code>\u53c2\u6570\u6765\u63a7\u5236\u6bcf\u6b21\u8fed\u4ee3\u7684\u8f93\u51fa\u683c\u5f0f\u3002\u4f8b\u5982\uff0c\u5982\u679c\u60a8\u5e0c\u671b\u5728\u5faa\u73af\u4e2d\u6253\u5370\u6570\u5b57\u5e76\u5728\u6bcf\u4e2a\u6570\u5b57\u540e\u6dfb\u52a0\u4e00\u4e2a\u9017\u53f7\u800c\u4e0d\u662f\u6362\u884c\uff0c\u53ef\u4ee5\u8fd9\u6837\u5b9e\u73b0\uff1a  <\/p>\n<pre><code class=\"language-python\">for i in range(5):\n    print(i, end=&#39;, &#39;)\n<\/code><\/pre>\n<p>\u8fd9\u6837\uff0c\u8f93\u51fa\u7ed3\u679c\u5c06\u662f<code>0, 1, 2, 3, 4, <\/code>\uff0c\u6ca1\u6709\u6362\u884c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u63a7\u5236Python\u6253\u5370\u6362\u884c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e9b\u6280\u5de7\u548c\u65b9\u6cd5\uff0c\u5305\u62ec\u4f7f\u7528end\u53c2\u6570\u3001\u4f7f\u7528\u8f6c\u4e49\u5b57\u7b26\u3001\u5b57\u7b26\u4e32\u8fde\u63a5\u7b49\u3002\u4e0b\u9762\u6211\u4eec\u8be6 [&hellip;]","protected":false},"author":3,"featured_media":1158532,"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\/1158525"}],"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=1158525"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1158525\/revisions"}],"predecessor-version":[{"id":1158533,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1158525\/revisions\/1158533"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1158532"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1158525"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1158525"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1158525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}