{"id":995508,"date":"2024-12-27T09:05:26","date_gmt":"2024-12-27T01:05:26","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/995508.html"},"modified":"2024-12-27T09:05:28","modified_gmt":"2024-12-27T01:05:28","slug":"python%e5%a6%82%e4%bd%95%e6%8d%a2%e8%a1%8c%e4%b8%8d%e8%be%93%e5%87%ba","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/995508.html","title":{"rendered":"python\u5982\u4f55\u6362\u884c\u4e0d\u8f93\u51fa"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25072055\/666b93a8-72f3-41c3-aef4-1b10a6a7248c.webp\" alt=\"python\u5982\u4f55\u6362\u884c\u4e0d\u8f93\u51fa\" \/><\/p>\n<p><p> <strong>\u5728Python\u4e2d\u6362\u884c\u4e0d\u8f93\u51fa\uff0c\u53ef\u4ee5\u4f7f\u7528\u53cd\u659c\u6760 ()\u3001\u4f7f\u7528\u62ec\u53f7\u3001\u4f7f\u7528\u7eed\u884c\u7b26\u53f7\u7b49\u65b9\u6cd5\u3002\u5176\u4e2d\uff0c\u4f7f\u7528\u53cd\u659c\u6760\u662f\u6700\u5e38\u89c1\u7684\u65b9\u6cd5\u3002<\/strong>\u901a\u8fc7\u5728\u884c\u5c3e\u6dfb\u52a0\u53cd\u659c\u6760\uff0c\u53ef\u4ee5\u5c06\u4e00\u884c\u4ee3\u7801\u62c6\u5206\u4e3a\u591a\u884c\uff0c\u800c\u4e0d\u4f1a\u5f71\u54cd\u4ee3\u7801\u7684\u6267\u884c\u7ed3\u679c\u3002\u8fd9\u5728\u5904\u7406\u957f\u4ee3\u7801\u884c\u65f6\u5c24\u4e3a\u6709\u7528\u3002\u53e6\u4e00\u4e2a\u5e38\u7528\u7684\u65b9\u6cd5\u662f\u4f7f\u7528\u62ec\u53f7\uff0c\u5982\u5706\u62ec\u53f7\u3001\u65b9\u62ec\u53f7\u6216\u82b1\u62ec\u53f7\uff0c\u5c06\u4ee3\u7801\u5206\u7ec4\uff0c\u8fd9\u6837Python\u4f1a\u81ea\u52a8\u7406\u89e3\u4e3a\u903b\u8f91\u4e0a\u7684\u4e00\u884c\u3002\u4ee5\u4e0b\u662f\u5bf9\u4f7f\u7528\u53cd\u659c\u6760\u7684\u8be6\u7ec6\u63cf\u8ff0\u3002<\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u53cd\u659c\u6760\u6362\u884c\u662fPython\u4e2d\u7684\u4e00\u79cd\u663e\u5f0f\u65b9\u6cd5\u3002\u53cd\u659c\u6760\u653e\u5728\u884c\u5c3e\u8868\u793a\u4e0b\u4e00\u884c\u4ecd\u7136\u662f\u5f53\u524d\u884c\u7684\u5ef6\u7eed\uff0cPython\u89e3\u91ca\u5668\u4f1a\u5c06\u8fd9\u4e9b\u884c\u5408\u5e76\u4e3a\u4e00\u884c\u8fdb\u884c\u5904\u7406\u3002\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u9700\u8981\u5c06\u957f\u4ee3\u7801\u884c\u62c6\u5206\u4e3a\u591a\u4e2a\u53ef\u8bfb\u6027\u66f4\u9ad8\u7684\u884c\uff0c\u4f8b\u5982\u5728\u5b9a\u4e49\u957f\u5b57\u7b26\u4e32\u3001\u5217\u8868\u3001\u5b57\u5178\u6216\u590d\u6742\u7684\u8868\u8fbe\u5f0f\u65f6\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u53cd\u659c\u6760\u540e\u9762\u4e0d\u80fd\u6709\u4efb\u4f55\u5b57\u7b26\uff0c\u5305\u62ec\u7a7a\u683c\uff0c\u5426\u5219\u4f1a\u5bfc\u81f4\u8bed\u6cd5\u9519\u8bef\u3002<\/p>\n<\/p>\n<hr>\n<p><p>\u4e00\u3001\u4f7f\u7528\u53cd\u659c\u6760 () \u6362\u884c<\/p>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c\u53cd\u659c\u6760\uff08\\\uff09\u662f\u4e00\u4e2a\u7eed\u884c\u7b26\uff0c\u7528\u4e8e\u8868\u793a\u5f53\u524d\u884c\u672a\u7ed3\u675f\uff0c\u4e0b\u4e00\u884c\u662f\u5176\u5ef6\u7eed\u3002\u8fd9\u79cd\u65b9\u6cd5\u53ef\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\uff0c\u5c24\u5176\u662f\u5728\u5904\u7406\u957f\u5b57\u7b26\u4e32\u6216\u8868\u8fbe\u5f0f\u65f6\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u57fa\u672c\u4f7f\u7528<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u53cd\u659c\u6760\u6362\u884c\u7684\u8bed\u6cd5\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u9700\u5728\u9700\u8981\u6362\u884c\u7684\u5730\u65b9\u6dfb\u52a0\u4e00\u4e2a\u53cd\u659c\u6760\uff0c\u63a5\u7740\u5728\u4e0b\u4e00\u884c\u7ee7\u7eed\u7f16\u5199\u4ee3\u7801\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">long_string = &quot;This is a very long string that we want to &quot; \\<\/p>\n<p>              &quot;split across multiple lines for better readability.&quot;<\/p>\n<p>print(long_string)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u957f\u5b57\u7b26\u4e32\u88ab\u62c6\u5206\u6210\u4e24\u884c\uff0c\u4f46\u5728\u6253\u5370\u65f6\u4ecd\u7136\u662f\u4e00\u4e2a\u5b8c\u6574\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6ce8\u610f\u4e8b\u9879<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u53cd\u659c\u6760\u6362\u884c\u65f6\uff0c\u53cd\u659c\u6760\u540e\u9762\u4e0d\u80fd\u6709\u4efb\u4f55\u5b57\u7b26\uff0c\u5305\u62ec\u7a7a\u683c\uff0c\u5426\u5219\u4f1a\u5bfc\u81f4\u8bed\u6cd5\u9519\u8bef\u3002\u6b64\u5916\uff0c\u53cd\u659c\u6760\u6362\u884c\u4ec5\u9650\u4e8e\u5728\u540c\u4e00\u903b\u8f91\u884c\u4e2d\uff0c\u4e0d\u80fd\u7528\u4e8e\u5757\u8bed\u53e5\u4e4b\u95f4\u7684\u6362\u884c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u9519\u8bef\u793a\u4f8b\uff1a\u53cd\u659c\u6760\u540e\u6709\u7a7a\u683c<\/p>\n<p>total = 1 + 2 + 3 + \\<\/p>\n<p>        4 + 5 + 6 + \\<\/p>\n<p>        7 + 8 + 9 + \\ <\/p>\n<p>        10<\/p>\n<h2><strong>\u6b63\u786e\u793a\u4f8b<\/strong><\/h2>\n<p>total = 1 + 2 + 3 + \\<\/p>\n<p>        4 + 5 + 6 + \\<\/p>\n<p>        7 + 8 + 9 + \\<\/p>\n<p>        10<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u4f7f\u7528\u62ec\u53f7\u6362\u884c<\/p>\n<\/p>\n<p><p>Python\u5141\u8bb8\u5728\u62ec\u53f7\u5185\u7684\u8868\u8fbe\u5f0f\u81ea\u52a8\u6362\u884c\uff0c\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u4ec5\u9650\u4e8e\u5706\u62ec\u53f7\uff0c\u8fd8\u9002\u7528\u4e8e\u65b9\u62ec\u53f7\u548c\u82b1\u62ec\u53f7\u3002\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u8ba9\u4ee3\u7801\u66f4\u52a0\u6574\u6d01\uff0c\u907f\u514d\u4f7f\u7528\u53cd\u659c\u6760\u5e26\u6765\u7684\u989d\u5916\u5b57\u7b26\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5706\u62ec\u53f7\u6362\u884c<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u51fd\u6570\u8c03\u7528\u6216\u6570\u5b66\u8868\u8fbe\u5f0f\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u5706\u62ec\u53f7\u6765\u5b9e\u73b0\u6362\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">result = (1 + 2 + 3 +<\/p>\n<p>          4 + 5 + 6 +<\/p>\n<p>          7 + 8 + 9 +<\/p>\n<p>          10)<\/p>\n<p>print(result)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u6b64\u793a\u4f8b\u4e2d\uff0c\u6570\u5b66\u8868\u8fbe\u5f0f\u88ab\u62c6\u5206\u4e3a\u591a\u884c\uff0c\u901a\u8fc7\u5706\u62ec\u53f7\u5305\u88f9\uff0cPython\u89e3\u91ca\u5668\u4f1a\u5c06\u5176\u89c6\u4e3a\u4e00\u4e2a\u6574\u4f53\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u65b9\u62ec\u53f7\u548c\u82b1\u62ec\u53f7\u6362\u884c<\/strong><\/p>\n<\/p>\n<p><p>\u5f53\u5904\u7406\u5217\u8868\u3001\u5b57\u5178\u6216\u96c6\u5408\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u65b9\u62ec\u53f7\u6216\u82b1\u62ec\u53f7\u6765\u5b9e\u73b0\u6362\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">numbers = [<\/p>\n<p>    1, 2, 3,<\/p>\n<p>    4, 5, 6,<\/p>\n<p>    7, 8, 9,<\/p>\n<p>    10<\/p>\n<p>]<\/p>\n<p>person = {<\/p>\n<p>    &quot;name&quot;: &quot;John&quot;,<\/p>\n<p>    &quot;age&quot;: 30,<\/p>\n<p>    &quot;city&quot;: &quot;New York&quot;<\/p>\n<p>}<\/p>\n<p>print(numbers)<\/p>\n<p>print(person)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u65b9\u62ec\u53f7\u548c\u82b1\u62ec\u53f7\u5185\u90e8\u7684\u6362\u884c\u4e0d\u4ec5\u63d0\u9ad8\u4e86\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\uff0c\u8fd8\u4f7f\u5f97\u5728\u6dfb\u52a0\u6216\u5220\u9664\u5143\u7d20\u65f6\u66f4\u52a0\u65b9\u4fbf\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u4f7f\u7528\u7eed\u884c\u7b26\u53f7<\/p>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u5c24\u5176\u662f\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u6216\u7279\u5b9a\u8bed\u6cd5\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u4f7f\u7528\u7eed\u884c\u7b26\u53f7\u7684\u9700\u6c42\u3002\u8fd9\u79cd\u65b9\u6cd5\u867d\u7136\u4e0d\u5e38\u7528\uff0c\u4f46\u5728\u67d0\u4e9b\u7279\u5b9a\u573a\u666f\u4e0b\u662f\u5fc5\u8981\u7684\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u7eed\u884c\u7b26\u53f7\u7684\u4f7f\u7528<\/strong><\/p>\n<\/p>\n<p><p>\u7eed\u884c\u7b26\u53f7\u901a\u5e38\u7528\u4e8e\u957f\u5b57\u7b26\u4e32\u6216\u8868\u8fbe\u5f0f\u4e2d\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">query = (&quot;SELECT id, name, age FROM users WHERE age &gt; 18 &quot;<\/p>\n<p>         &quot;AND city = &#39;New York&#39;&quot;)<\/p>\n<p>print(query)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0cSQL\u67e5\u8be2\u8bed\u53e5\u88ab\u62c6\u5206\u4e3a\u591a\u884c\uff0c\u4f46\u5728\u6253\u5370\u65f6\u4ecd\u7136\u662f\u4e00\u4e2a\u5b8c\u6574\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7eed\u884c\u7b26\u53f7\u7684\u6ce8\u610f\u4e8b\u9879<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u7eed\u884c\u7b26\u53f7\u65f6\uff0c\u8981\u786e\u4fdd\u5b57\u7b26\u4e32\u6216\u8868\u8fbe\u5f0f\u7684\u903b\u8f91\u5b8c\u6574\u6027\uff0c\u907f\u514d\u5728\u8bed\u53e5\u4e2d\u95f4\u968f\u610f\u6362\u884c\u3002\u4f8b\u5982\uff0c\u5728SQL\u67e5\u8be2\u4e2d\uff0c\u6362\u884c\u4e0d\u80fd\u5f71\u54cd\u67e5\u8be2\u8bed\u53e5\u7684\u7ed3\u6784\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u5728\u5b57\u7b26\u4e32\u4e2d\u6362\u884c<\/p>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c\u5b57\u7b26\u4e32\u5185\u90e8\u7684\u6362\u884c\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u4e09\u91cd\u5f15\u53f7\uff08&quot;&quot;&quot;\u6216&#39;&#39;&#39;\uff09\u5b9e\u73b0\u3002\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u591a\u884c\u5b57\u7b26\u4e32\u6216\u6587\u6863\u5b57\u7b26\u4e32\u7684\u5b9a\u4e49\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4e09\u91cd\u5f15\u53f7\u6362\u884c<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u4e09\u91cd\u5f15\u53f7\u5b9a\u4e49\u7684\u5b57\u7b26\u4e32\u53ef\u4ee5\u76f4\u63a5\u5305\u542b\u6362\u884c\u7b26\uff0c\u65e0\u9700\u989d\u5916\u7684\u6362\u884c\u7b26\u53f7\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">description = &quot;&quot;&quot;This is a multi-line string.<\/p>\n<p>It can cont<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>n line breaks.<\/p>\n<p>This is useful for documentation.&quot;&quot;&quot;<\/p>\n<p>print(description)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u4ec5\u53ef\u4ee5\u5728\u5b57\u7b26\u4e32\u4e2d\u76f4\u63a5\u5305\u542b\u6362\u884c\u7b26\uff0c\u8fd8\u53ef\u4ee5\u5728\u7f16\u5199\u6587\u6863\u5b57\u7b26\u4e32\u65f6\u4f7f\u7528\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4e09\u91cd\u5f15\u53f7\u7684\u4f18\u70b9<\/strong><\/p>\n<\/p>\n<p><p>\u4e09\u91cd\u5f15\u53f7\u7684\u4f7f\u7528\u4e0d\u4ec5\u7b80\u5316\u4e86\u591a\u884c\u5b57\u7b26\u4e32\u7684\u5b9a\u4e49\uff0c\u8fd8\u63d0\u9ad8\u4e86\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\uff0c\u5c24\u5176\u662f\u5728\u5904\u7406\u957f\u6587\u6863\u5b57\u7b26\u4e32\u65f6\u3002\u4f8b\u5982\uff0c\u5728\u51fd\u6570\u5b9a\u4e49\u4e2d\u4f7f\u7528\u6587\u6863\u5b57\u7b26\u4e32\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def example_function():<\/p>\n<p>    &quot;&quot;&quot;<\/p>\n<p>    This is an example function.<\/p>\n<p>    It demonstrates the use of docstrings.<\/p>\n<p>    &quot;&quot;&quot;<\/p>\n<p>    pass<\/p>\n<p>print(example_function.__doc__)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u6b64\u793a\u4f8b\u4e2d\uff0c\u6587\u6863\u5b57\u7b26\u4e32\u7528\u4e8e\u63cf\u8ff0\u51fd\u6570\u7684\u7528\u9014\u548c\u4f7f\u7528\u65b9\u6cd5\uff0c\u4fbf\u4e8e\u7406\u89e3\u548c\u7ef4\u62a4\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u603b\u7ed3\u4e0e\u5efa\u8bae<\/p>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c\u5b9e\u73b0\u6362\u884c\u800c\u4e0d\u8f93\u51fa\u7684\u65b9\u5f0f\u6709\u591a\u79cd\uff0c\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u53ef\u4ee5\u63d0\u9ad8\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5efa\u8bae\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u9009\u62e9\u5408\u9002\u7684\u6362\u884c\u65b9\u5f0f<\/strong><\/p>\n<\/p>\n<p><p>\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u6362\u884c\u65b9\u5f0f\uff1a\u4f7f\u7528\u53cd\u659c\u6760\u9002\u7528\u4e8e\u7b80\u5355\u7684\u884c\u7eed\uff0c\u4f7f\u7528\u62ec\u53f7\u9002\u7528\u4e8e\u590d\u6742\u7684\u8868\u8fbe\u5f0f\uff0c\u4f7f\u7528\u4e09\u91cd\u5f15\u53f7\u9002\u7528\u4e8e\u591a\u884c\u5b57\u7b26\u4e32\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4fdd\u6301\u4ee3\u7801\u6574\u6d01<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528\u6362\u884c\u65f6\uff0c\u6ce8\u610f\u4fdd\u6301\u4ee3\u7801\u7684\u6574\u6d01\u548c\u4e00\u81f4\u6027\uff0c\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u7a7a\u884c\u548c\u7f29\u8fdb\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6ce8\u91cd\u53ef\u8bfb\u6027<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u62c6\u5206\u957f\u884c\u4ee3\u7801\u65f6\uff0c\u5c3d\u91cf\u4fdd\u6301\u4ee3\u7801\u903b\u8f91\u7684\u5b8c\u6574\u6027\u548c\u53ef\u8bfb\u6027\uff0c\u907f\u514d\u56e0\u4e3a\u6362\u884c\u800c\u5bfc\u81f4\u7406\u89e3\u56f0\u96be\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u5408\u7406\u4f7f\u7528Python\u4e2d\u7684\u6362\u884c\u65b9\u5f0f\uff0c\u53ef\u4ee5\u7f16\u5199\u51fa\u66f4\u52a0\u7b80\u6d01\u3001\u6e05\u6670\u3001\u6613\u4e8e\u7ef4\u62a4\u7684\u4ee3\u7801\u3002\u65e0\u8bba\u662f\u5904\u7406\u957f\u5b57\u7b26\u4e32\u3001\u590d\u6742\u8868\u8fbe\u5f0f\uff0c\u8fd8\u662f\u7f16\u5199\u6587\u6863\u5b57\u7b26\u4e32\uff0c\u5408\u9002\u7684\u6362\u884c\u65b9\u6cd5\u90fd\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u5de5\u5177\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u5b9e\u73b0\u6362\u884c\u800c\u4e0d\u8f93\u51fa\u4efb\u4f55\u5185\u5bb9\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528 <code>print<\/code> \u51fd\u6570\u7684 <code>end<\/code> \u53c2\u6570\u6765\u5b9e\u73b0\u6362\u884c\u800c\u4e0d\u8f93\u51fa\u4efb\u4f55\u5185\u5bb9\u3002\u901a\u8fc7\u8bbe\u7f6e <code>end<\/code> \u53c2\u6570\u4e3a\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\uff0c\u53ef\u4ee5\u907f\u514d\u5728\u884c\u5c3e\u8f93\u51fa\u6362\u884c\u7b26\u3002\u4f8b\u5982\uff0c<code>print(&quot;&quot;, end=&quot;\\n&quot;)<\/code> \u53ef\u4ee5\u5728\u4e0d\u8f93\u51fa\u4efb\u4f55\u5176\u4ed6\u5185\u5bb9\u7684\u60c5\u51b5\u4e0b\uff0c\u5b9e\u73b0\u6362\u884c\u6548\u679c\u3002<\/p>\n<p><strong>\u5728Python\u4e2d\u600e\u6837\u521b\u5efa\u4e00\u4e2a\u7a7a\u884c\u800c\u4e0d\u663e\u793a\u4efb\u4f55\u6587\u672c\uff1f<\/strong><br \/>\u82e5\u5e0c\u671b\u5728\u8f93\u51fa\u4e2d\u63d2\u5165\u4e00\u4e2a\u7a7a\u884c\u800c\u4e0d\u663e\u793a\u4efb\u4f55\u6587\u672c\uff0c\u53ef\u4ee5\u4f7f\u7528 <code>print()<\/code> \u51fd\u6570\u800c\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u3002\u8fd9\u6837\u4f1a\u9ed8\u8ba4\u8f93\u51fa\u4e00\u4e2a\u6362\u884c\u7b26\uff0c\u5b9e\u73b0\u7a7a\u884c\u7684\u6548\u679c\u3002\u4f8b\u5982\uff0c\u7b80\u5355\u5730\u8c03\u7528 <code>print()<\/code> \u5373\u53ef\u521b\u5efa\u4e00\u4e2a\u7a7a\u884c\u3002<\/p>\n<p><strong>\u662f\u5426\u53ef\u4ee5\u5728Python\u7684\u591a\u884c\u5b57\u7b26\u4e32\u4e2d\u6362\u884c\u800c\u4e0d\u5b9e\u9645\u8f93\u51fa\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u4f7f\u7528\u591a\u884c\u5b57\u7b26\u4e32\uff08\u7528\u4e09\u4e2a\u5f15\u53f7\u5305\u56f4\uff09\u65f6\uff0c\u5b57\u7b26\u4e32\u5185\u90e8\u7684\u6362\u884c\u7b26\u4e0d\u4f1a\u88ab\u7acb\u5373\u8f93\u51fa\u3002\u5982\u679c\u5e0c\u671b\u5728\u591a\u884c\u5b57\u7b26\u4e32\u4e2d\u6362\u884c\u800c\u4e0d\u6253\u5370\uff0c\u53ef\u4ee5\u5c06\u5176\u5b58\u50a8\u5728\u53d8\u91cf\u4e2d\u800c\u4e0d\u8c03\u7528 <code>print()<\/code>\u3002\u4f8b\u5982\uff1a  <\/p>\n<pre><code class=\"language-python\">text = &quot;&quot;&quot;\u8fd9\u662f\u4e00\u6bb5\n\u591a\u884c\u5b57\u7b26\u4e32&quot;&quot;&quot;\n<\/code><\/pre>\n<p>\u8fd9\u6837\uff0c<code>text<\/code> \u53d8\u91cf\u4e2d\u4f1a\u4fdd\u7559\u6362\u884c\uff0c\u4f46\u4e0d\u4f1a\u8f93\u51fa\uff0c\u76f4\u5230\u4f7f\u7528 <code>print(text)<\/code>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\u6362\u884c\u4e0d\u8f93\u51fa\uff0c\u53ef\u4ee5\u4f7f\u7528\u53cd\u659c\u6760 ()\u3001\u4f7f\u7528\u62ec\u53f7\u3001\u4f7f\u7528\u7eed\u884c\u7b26\u53f7\u7b49\u65b9\u6cd5\u3002\u5176\u4e2d\uff0c\u4f7f\u7528\u53cd\u659c\u6760\u662f\u6700\u5e38\u89c1\u7684\u65b9\u6cd5 [&hellip;]","protected":false},"author":3,"featured_media":995513,"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\/995508"}],"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=995508"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/995508\/revisions"}],"predecessor-version":[{"id":995514,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/995508\/revisions\/995514"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/995513"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=995508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=995508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=995508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}