{"id":986691,"date":"2024-12-27T07:47:08","date_gmt":"2024-12-26T23:47:08","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/986691.html"},"modified":"2024-12-27T07:47:10","modified_gmt":"2024-12-26T23:47:10","slug":"python%e5%a6%82%e4%bd%95%e8%bf%90%e8%a1%8c%e7%a5%96%e5%9b%bd%e4%bd%a0%e5%a5%bd","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/986691.html","title":{"rendered":"python\u5982\u4f55\u8fd0\u884c\u7956\u56fd\u4f60\u597d"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25063147\/9d7e667e-94c7-44bd-9fcb-97b60788a3ae.webp\" alt=\"python\u5982\u4f55\u8fd0\u884c\u7956\u56fd\u4f60\u597d\" \/><\/p>\n<p><p> <strong>\u8981\u5728Python\u4e2d\u8fd0\u884c\u201c\u7956\u56fd\u4f60\u597d\u201d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528Python\u7684print\u51fd\u6570\u6253\u5370\u51fa\u8fd9\u53e5\u8bdd\u3001\u4f7f\u7528\u5b57\u7b26\u4e32\u7f16\u7801\u6b63\u786e\u5904\u7406\u5b57\u7b26\u3001\u786e\u4fddPython\u73af\u5883\u914d\u7f6e\u6b63\u786e<\/strong>\u3002\u5176\u4e2d\uff0c\u6700\u5173\u952e\u7684\u662f\u786e\u4fddPython\u73af\u5883\u652f\u6301\u4e2d\u6587\u5b57\u7b26\u7f16\u7801\uff0c\u901a\u5e38\u4f7f\u7528UTF-8\u7f16\u7801\u53ef\u4ee5\u5f88\u597d\u5730\u5904\u7406\u4e2d\u6587\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u7684Python\u73af\u5883\u6b63\u786e\u914d\u7f6e\u4ee5\u652f\u6301\u4e2d\u6587\u5b57\u7b26\u3002\u5728\u5927\u591a\u6570\u73b0\u4ee3Python\u7248\u672c\u4e2d\uff0cUTF-8\u7f16\u7801\u662f\u9ed8\u8ba4\u7684\uff0c\u56e0\u6b64\u4f60\u53ef\u4ee5\u76f4\u63a5\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528\u4e2d\u6587\u5b57\u7b26\u800c\u65e0\u9700\u989d\u5916\u7684\u8bbe\u7f6e\u3002\u7136\u800c\uff0c\u5728\u4e00\u4e9b\u7279\u6b8a\u7684\u73af\u5883\u4e0b\uff0c\u53ef\u80fd\u9700\u8981\u624b\u52a8\u8bbe\u7f6e\u7f16\u7801\uff0c\u4ee5\u786e\u4fdd\u6b63\u786e\u663e\u793a\u548c\u5904\u7406\u4e2d\u6587\u5b57\u7b26\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u5728Python\u4e2d\u76f4\u63a5\u6253\u5370\u4e2d\u6587\u5b57\u7b26<\/p>\n<p>print(&quot;\u7956\u56fd\u4f60\u597d&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u6df1\u5165\u63a2\u8ba8Python\u4e2d\u5982\u4f55\u5904\u7406\u548c\u8fd0\u884c\u4e2d\u6587\u5b57\u7b26\uff0c\u5305\u62ec\u73af\u5883\u914d\u7f6e\u3001\u7f16\u7801\u95ee\u9898\u3001\u4ee5\u53ca\u5e38\u89c1\u7684\u9519\u8bef\u548c\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u914d\u7f6ePython\u73af\u5883<\/p>\n<\/p>\n<p><p>\u5728\u8fd0\u884cPython\u7a0b\u5e8f\u4e4b\u524d\uff0c\u786e\u4fdd\u4f60\u7684\u5f00\u53d1\u73af\u5883\u80fd\u591f\u6b63\u786e\u5904\u7406\u4e2d\u6587\u5b57\u7b26\u3002\u901a\u5e38\uff0c\u8fd9\u6d89\u53ca\u5230Python\u89e3\u91ca\u5668\u7684\u8bbe\u7f6e\u3001\u64cd\u4f5c\u7cfb\u7edf\u7684\u8bed\u8a00\u652f\u6301\uff0c\u4ee5\u53ca\u4ee3\u7801\u7f16\u8f91\u5668\u7684\u914d\u7f6e\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>Python\u89e3\u91ca\u5668\u7684\u914d\u7f6e<\/strong><\/p>\n<\/p>\n<p><p>\u5927\u591a\u6570\u73b0\u4ee3Python\u7248\u672c\uff08\u5982Python 3.x\uff09\u9ed8\u8ba4\u4f7f\u7528UTF-8\u7f16\u7801\uff0c\u8fd9\u4f7f\u5f97\u5904\u7406\u4e2d\u6587\u5b57\u7b26\u76f8\u5bf9\u7b80\u5355\u3002\u4f46\u662f\uff0c\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662fPython 2.x\u7248\u672c\uff0c\u4f60\u9700\u8981\u5728\u6587\u4ef6\u7684\u5f00\u5934\u6dfb\u52a0\u4ee5\u4e0b\u6ce8\u91ca\u6765\u6307\u5b9aUTF-8\u7f16\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># -*- coding: utf-8 -*-<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u884c\u4ee3\u7801\u544a\u8bc9Python\u89e3\u91ca\u5668\u4f7f\u7528UTF-8\u7f16\u7801\u6765\u89e3\u6790\u6587\u4ef6\u4e2d\u7684\u5b57\u7b26\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u64cd\u4f5c\u7cfb\u7edf\u7684\u8bed\u8a00\u652f\u6301<\/strong><\/p>\n<\/p>\n<p><p>\u786e\u4fdd\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u8bbe\u7f6e\u4e3a\u652f\u6301\u4e2d\u6587\u5b57\u7b26\u3002\u5bf9\u4e8eWindows\u7528\u6237\uff0c\u53ef\u4ee5\u5728\u63a7\u5236\u9762\u677f\u4e2d\u66f4\u6539\u533a\u57df\u548c\u8bed\u8a00\u8bbe\u7f6e\u3002\u5bf9\u4e8eMac\u548cLinux\u7528\u6237\uff0c\u53ef\u4ee5\u901a\u8fc7\u7cfb\u7edf\u8bbe\u7f6e\u6765\u786e\u4fdd\u4e2d\u6587\u8bed\u8a00\u652f\u6301\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4ee3\u7801\u7f16\u8f91\u5668\u7684\u914d\u7f6e<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528\u652f\u6301UTF-8\u7f16\u7801\u7684\u4ee3\u7801\u7f16\u8f91\u5668\uff0c\u4f8b\u5982VSCode\u3001PyCharm\u6216Sublime Text\u7b49\u3002\u5728\u7f16\u8f91\u5668\u7684\u8bbe\u7f6e\u4e2d\uff0c\u786e\u4fdd\u6587\u4ef6\u7f16\u7801\u8bbe\u7f6e\u4e3aUTF-8\uff0c\u4ee5\u907f\u514d\u5b57\u7b26\u7f16\u7801\u95ee\u9898\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u5904\u7406\u5b57\u7b26\u4e32\u7f16\u7801<\/p>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c\u5b57\u7b26\u4e32\u5904\u7406\u662f\u4e00\u4e2a\u91cd\u8981\u7684\u90e8\u5206\uff0c\u7279\u522b\u662f\u5f53\u6d89\u53ca\u5230\u591a\u8bed\u8a00\u652f\u6301\u65f6\u3002\u4e86\u89e3\u5982\u4f55\u5728Python\u4e2d\u6b63\u786e\u5904\u7406\u5b57\u7b26\u4e32\u7f16\u7801\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u907f\u514d\u5e38\u89c1\u7684\u7f16\u7801\u9519\u8bef\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b57\u7b26\u4e32\u5728Python 3\u4e2d\u7684\u5904\u7406<\/strong><\/p>\n<\/p>\n<p><p>\u5728Python 3\u4e2d\uff0c\u5b57\u7b26\u4e32\u9ed8\u8ba4\u662fUnicode\u7f16\u7801\uff0c\u8fd9\u610f\u5473\u7740\u4f60\u53ef\u4ee5\u76f4\u63a5\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528\u4e2d\u6587\u5b57\u7b26\u800c\u65e0\u9700\u989d\u5916\u7684\u7f16\u7801\u8f6c\u6362\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">greeting = &quot;\u7956\u56fd\u4f60\u597d&quot;<\/p>\n<p>print(greeting)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u4f1a\u6b63\u786e\u8f93\u51fa\u201c\u7956\u56fd\u4f60\u597d\u201d\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5904\u7406\u6587\u4ef6\u4e2d\u7684\u4e2d\u6587\u5b57\u7b26<\/strong><\/p>\n<\/p>\n<p><p>\u5982\u679c\u4f60\u7684Python\u7a0b\u5e8f\u9700\u8981\u8bfb\u53d6\u6216\u5199\u5165\u5305\u542b\u4e2d\u6587\u5b57\u7b26\u7684\u6587\u4ef6\uff0c\u786e\u4fdd\u5728\u6253\u5f00\u6587\u4ef6\u65f6\u6307\u5b9a\u6b63\u786e\u7684\u7f16\u7801\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">with open(&quot;example.txt&quot;, &quot;r&quot;, encoding=&quot;utf-8&quot;) as file:<\/p>\n<p>    content = file.read()<\/p>\n<p>    print(content)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u901a\u8fc7\u6307\u5b9a<code>encoding=&quot;utf-8&quot;<\/code>\uff0c\u4f60\u53ef\u4ee5\u786e\u4fdd\u6587\u4ef6\u4e2d\u7684\u4e2d\u6587\u5b57\u7b26\u88ab\u6b63\u786e\u89e3\u6790\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u5e38\u89c1\u9519\u8bef\u53ca\u89e3\u51b3\u65b9\u6848<\/p>\n<\/p>\n<p><p>\u5904\u7406\u4e2d\u6587\u5b57\u7b26\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u5e38\u89c1\u7684\u9519\u8bef\uff0c\u5982\u5b57\u7b26\u4e71\u7801\u3001\u7f16\u7801\u9519\u8bef\u7b49\u3002\u4e86\u89e3\u8fd9\u4e9b\u9519\u8bef\u53ca\u5176\u89e3\u51b3\u65b9\u6848\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u66f4\u6709\u6548\u5730\u8c03\u8bd5Python\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b57\u7b26\u4e71\u7801\u95ee\u9898<\/strong><\/p>\n<\/p>\n<p><p>\u5b57\u7b26\u4e71\u7801\u901a\u5e38\u662f\u7531\u4e8e\u7f16\u7801\u4e0d\u5339\u914d\u5bfc\u81f4\u7684\u3002\u786e\u4fdd\u5728\u6253\u5f00\u6587\u4ef6\u6216\u5904\u7406\u5b57\u7b26\u4e32\u65f6\uff0c\u4f7f\u7528\u4e0e\u6587\u4ef6\u6216\u6570\u636e\u6e90\u76f8\u5339\u914d\u7684\u7f16\u7801\u683c\u5f0f\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7f16\u7801\u9519\u8bef\uff08UnicodeEncodeError\/UnicodeDecodeError\uff09<\/strong><\/p>\n<\/p>\n<p><p>\u8fd9\u4e9b\u9519\u8bef\u901a\u5e38\u53d1\u751f\u5728\u5c1d\u8bd5\u5c06Unicode\u5b57\u7b26\u4e32\u7f16\u7801\u4e3a\u5b57\u8282\u4e32\u6216\u4ece\u5b57\u8282\u4e32\u89e3\u7801\u4e3aUnicode\u5b57\u7b26\u4e32\u65f6\u3002\u89e3\u51b3\u8fd9\u4e9b\u9519\u8bef\u7684\u65b9\u6cd5\u662f\u786e\u4fdd\u4f7f\u7528\u6b63\u786e\u7684\u7f16\u7801\u683c\u5f0f\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u5c06\u5b57\u7b26\u4e32\u7f16\u7801\u4e3a\u5b57\u8282\u4e32<\/p>\n<p>byte_string = &quot;\u7956\u56fd\u4f60\u597d&quot;.encode(&quot;utf-8&quot;)<\/p>\n<h2><strong>\u4ece\u5b57\u8282\u4e32\u89e3\u7801\u4e3a\u5b57\u7b26\u4e32<\/strong><\/h2>\n<p>decoded_string = byte_string.decode(&quot;utf-8&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u786e\u4fdd\u6b63\u786e\u7684\u73af\u5883\u8bbe\u7f6e<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u786e\u4fdd\u4ee3\u7801\u6b63\u786e\u7684\u60c5\u51b5\u4e0b\uff0c\u68c0\u67e5\u4f60\u7684\u5f00\u53d1\u73af\u5883\u914d\u7f6e\uff0c\u786e\u4fddPython\u89e3\u91ca\u5668\u3001\u64cd\u4f5c\u7cfb\u7edf\u548c\u4ee3\u7801\u7f16\u8f91\u5668\u90fd\u652f\u6301UTF-8\u7f16\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u4f7f\u7528Python\u5e93\u5904\u7406\u4e2d\u6587<\/p>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c\u6709\u4e00\u4e9b\u7b2c\u4e09\u65b9\u5e93\u53ef\u4ee5\u5e2e\u52a9\u5904\u7406\u4e2d\u6587\u5b57\u7b26\uff0c\u7279\u522b\u662f\u5728\u6d89\u53ca\u5230\u6587\u672c\u5904\u7406\u548c\u81ea\u7136\u8bed\u8a00\u5904\u7406\u7684\u5e94\u7528\u4e2d\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>jieba\u5206\u8bcd\u5e93<\/strong><\/p>\n<\/p>\n<p><p>jieba\u662f\u4e00\u4e2a\u7528\u4e8e\u4e2d\u6587\u5206\u8bcd\u7684\u7b2c\u4e09\u65b9\u5e93\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5728\u5904\u7406\u4e2d\u6587\u6587\u672c\u65f6\u8fdb\u884c\u5206\u8bcd\u64cd\u4f5c\u3002\u4f7f\u7528jieba\u5e93\u53ef\u4ee5\u8f7b\u677e\u5730\u5c06\u4e2d\u6587\u53e5\u5b50\u5206\u5272\u4e3a\u8bcd\u8bed\uff0c\u9002\u7528\u4e8e\u6587\u672c\u5206\u6790\u548c\u81ea\u7136\u8bed\u8a00\u5904\u7406\u7b49\u5e94\u7528\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import jieba<\/p>\n<p>sentence = &quot;\u7956\u56fd\u4f60\u597d&quot;<\/p>\n<p>words = jieba.lcut(sentence)<\/p>\n<p>print(words)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u4f1a\u8f93\u51fa\u5206\u8bcd\u540e\u7684\u5217\u8868\uff1a<code>[&#39;\u7956\u56fd&#39;, &#39;\u4f60\u597d&#39;]<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5904\u7406\u4e2d\u6587\u6587\u672c\u7684\u5176\u4ed6\u5e93<\/strong><\/p>\n<\/p>\n<p><p>\u9664\u4e86jieba\uff0c\u8fd8\u6709\u5176\u4ed6\u4e00\u4e9b\u5e93\u53ef\u4ee5\u5e2e\u52a9\u5904\u7406\u4e2d\u6587\u6587\u672c\uff0c\u5982SnowNLP\u3001pkuseg\u7b49\u3002\u8fd9\u4e9b\u5e93\u63d0\u4f9b\u4e86\u66f4\u591a\u9ad8\u7ea7\u529f\u80fd\uff0c\u5982\u60c5\u611f\u5206\u6790\u3001\u5173\u952e\u8bcd\u63d0\u53d6\u7b49\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u603b\u7ed3<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u6b63\u786e\u914d\u7f6ePython\u73af\u5883\u3001\u7406\u89e3\u5b57\u7b26\u4e32\u7f16\u7801\u4ee5\u53ca\u4f7f\u7528\u9002\u5f53\u7684\u5e93\u548c\u5de5\u5177\uff0c\u53ef\u4ee5\u8f7b\u677e\u5730\u5728Python\u4e2d\u8fd0\u884c\u548c\u5904\u7406\u4e2d\u6587\u5b57\u7b26\u3002\u65e0\u8bba\u662f\u7b80\u5355\u7684\u6253\u5370\u8f93\u51fa\uff0c\u8fd8\u662f\u590d\u6742\u7684\u6587\u672c\u5206\u6790\uff0c\u638c\u63e1\u8fd9\u4e9b\u6280\u5de7\u5c06\u5e2e\u52a9\u4f60\u5728Python\u7f16\u7a0b\u4e2d\u66f4\u9ad8\u6548\u5730\u5904\u7406\u591a\u8bed\u8a00\u652f\u6301\u95ee\u9898\u3002\u786e\u4fdd\u4f60\u7684\u5f00\u53d1\u73af\u5883\u652f\u6301UTF-8\u7f16\u7801\uff0c\u5e76\u719f\u6089Python\u4e2d\u7684\u5b57\u7b26\u4e32\u5904\u7406\u65b9\u6cd5\uff0c\u662f\u6210\u529f\u8fd0\u884c\u201c\u7956\u56fd\u4f60\u597d\u201d\u7b49\u4e2d\u6587\u5b57\u7b26\u7684\u5173\u952e\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u8f93\u51fa\u201c\u7956\u56fd\u4f60\u597d\u201d\uff1f<\/strong><br \/>\u8981\u5728Python\u4e2d\u8f93\u51fa\u201c\u7956\u56fd\u4f60\u597d\u201d\uff0c\u60a8\u53ea\u9700\u4f7f\u7528print\u51fd\u6570\u3002\u5728\u60a8\u7684Python\u4ee3\u7801\u4e2d\u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9\u5373\u53ef\uff1a  <\/p>\n<pre><code class=\"language-python\">print(&quot;\u7956\u56fd\u4f60\u597d&quot;)\n<\/code><\/pre>\n<p>\u8fd0\u884c\u8fd9\u6bb5\u4ee3\u7801\u540e\uff0c\u63a7\u5236\u53f0\u5c06\u663e\u793a\u201c\u7956\u56fd\u4f60\u597d\u201d\u3002<\/p>\n<p><strong>\u5728Python\u4e2d\u53ef\u4ee5\u5b9e\u73b0\u54ea\u4e9b\u6587\u672c\u8f93\u51fa\u6548\u679c\uff1f<\/strong><br \/>Python\u7684print\u51fd\u6570\u5177\u6709\u591a\u79cd\u7528\u6cd5\uff0c\u53ef\u4ee5\u8f93\u51fa\u5b57\u7b26\u4e32\u3001\u6570\u5b57\u3001\u5217\u8868\u3001\u5b57\u5178\u7b49\u5404\u79cd\u6570\u636e\u7c7b\u578b\u3002\u60a8\u8fd8\u53ef\u4ee5\u4f7f\u7528\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\u3001\u8fde\u63a5\u5b57\u7b26\u4e32\u3001\u751a\u81f3\u8f93\u51fa\u591a\u884c\u6587\u672c\u3002\u4f8b\u5982\uff1a  <\/p>\n<pre><code class=\"language-python\">name = &quot;\u7956\u56fd&quot;\nprint(f&quot;{name}\u4f60\u597d&quot;)\n<\/code><\/pre>\n<p>\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u8ba9\u60a8\u5728\u8f93\u51fa\u4e2d\u5305\u542b\u53d8\u91cf\uff0c\u589e\u52a0\u4ee3\u7801\u7684\u7075\u6d3b\u6027\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Python\u7a0b\u5e8f\u4e2d\u6dfb\u52a0\u8f93\u5165\u529f\u80fd\uff1f<\/strong><br \/>\u60a8\u53ef\u4ee5\u4f7f\u7528input\u51fd\u6570\u6765\u83b7\u53d6\u7528\u6237\u8f93\u5165\uff0c\u4ece\u800c\u4f7f\u7a0b\u5e8f\u66f4\u5177\u4e92\u52a8\u6027\u3002\u4f8b\u5982\uff0c\u60a8\u53ef\u4ee5\u8ba9\u7528\u6237\u8f93\u5165\u4e00\u4e2a\u95ee\u5019\u8bed\u5e76\u8f93\u51fa\uff1a  <\/p>\n<pre><code class=\"language-python\">greeting = input(&quot;\u8bf7\u8f93\u5165\u60a8\u7684\u95ee\u5019\uff1a&quot;)\nprint(greeting)\n<\/code><\/pre>\n<p>\u8fd9\u6bb5\u4ee3\u7801\u4f1a\u63d0\u793a\u7528\u6237\u8f93\u5165\u5185\u5bb9\uff0c\u7136\u540e\u5c06\u7528\u6237\u8f93\u5165\u7684\u95ee\u5019\u8bed\u8f93\u51fa\u5230\u63a7\u5236\u53f0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u5728Python\u4e2d\u8fd0\u884c\u201c\u7956\u56fd\u4f60\u597d\u201d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528Python\u7684print\u51fd\u6570\u6253\u5370\u51fa\u8fd9\u53e5\u8bdd\u3001\u4f7f\u7528\u5b57\u7b26\u4e32\u7f16\u7801\u6b63\u786e\u5904 [&hellip;]","protected":false},"author":3,"featured_media":986698,"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\/986691"}],"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=986691"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/986691\/revisions"}],"predecessor-version":[{"id":986700,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/986691\/revisions\/986700"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/986698"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=986691"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=986691"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=986691"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}