{"id":1015396,"date":"2024-12-27T12:06:12","date_gmt":"2024-12-27T04:06:12","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1015396.html"},"modified":"2024-12-27T12:06:15","modified_gmt":"2024-12-27T04:06:15","slug":"python%e5%a6%82%e4%bd%95%e8%be%93%e5%85%a5%e4%bd%93%e9%87%8d%e6%af%94%e8%be%83","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1015396.html","title":{"rendered":"python\u5982\u4f55\u8f93\u5165\u4f53\u91cd\u6bd4\u8f83"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25095252\/444adeae-faa5-40f2-889a-e863d637848d.webp\" alt=\"python\u5982\u4f55\u8f93\u5165\u4f53\u91cd\u6bd4\u8f83\" \/><\/p>\n<p><p> <strong>\u5728Python\u4e2d\u8f93\u5165\u5e76\u6bd4\u8f83\u4f53\u91cd\u53ef\u4ee5\u901a\u8fc7\u51e0\u79cd\u65b9\u6cd5\u5b9e\u73b0\uff0c\u5305\u62ec\u4f7f\u7528\u5185\u7f6e\u51fd\u6570input()\u83b7\u53d6\u7528\u6237\u8f93\u5165\u3001\u5c06\u8f93\u5165\u6570\u636e\u8f6c\u6362\u4e3a\u6d6e\u70b9\u6570\u4ee5\u8fdb\u884c\u6bd4\u8f83\u3001\u4f7f\u7528\u6761\u4ef6\u8bed\u53e5\u5b9e\u73b0\u6bd4\u8f83\u903b\u8f91<\/strong>\u3002\u5176\u4e2d\uff0c\u8f93\u5165\u4f53\u91cd\u7684\u57fa\u672c\u6b65\u9aa4\u662f\u83b7\u53d6\u7528\u6237\u8f93\u5165\u5e76\u5c06\u5176\u8f6c\u6362\u4e3a\u9002\u5f53\u7684\u6570\u636e\u7c7b\u578b\uff0c\u7136\u540e\u901a\u8fc7if\u8bed\u53e5\u7b49\u63a7\u5236\u7ed3\u6784\u8fdb\u884c\u6bd4\u8f83\u548c\u51b3\u7b56\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5728Python\u4e2d\u5b9e\u73b0\u8fd9\u4e00\u8fc7\u7a0b\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u83b7\u53d6\u7528\u6237\u8f93\u5165<\/h3>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c\u83b7\u53d6\u7528\u6237\u8f93\u5165\u6700\u5e38\u7528\u7684\u65b9\u6cd5\u662f\u4f7f\u7528<code>input()<\/code>\u51fd\u6570\u3002<code>input()<\/code>\u51fd\u6570\u4f1a\u6682\u505c\u7a0b\u5e8f\u8fd0\u884c\uff0c\u7b49\u5f85\u7528\u6237\u8f93\u5165\uff0c\u5e76\u5c06\u7528\u6237\u8f93\u5165\u7684\u6570\u636e\u4f5c\u4e3a\u5b57\u7b26\u4e32\u8fd4\u56de\u3002\u4e3a\u4e86\u8fdb\u884c\u4f53\u91cd\u6bd4\u8f83\uff0c\u6211\u4eec\u9700\u8981\u5c06\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u6d6e\u70b9\u6570\uff0c\u8fd9\u53ef\u4ee5\u901a\u8fc7Python\u7684<code>float()<\/code>\u51fd\u6570\u6765\u5b9e\u73b0\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">weight1 = float(input(&quot;\u8bf7\u8f93\u5165\u7b2c\u4e00\u4e2a\u4eba\u7684\u4f53\u91cd\uff08\u516c\u65a4\uff09\uff1a&quot;))<\/p>\n<p>weight2 = float(input(&quot;\u8bf7\u8f93\u5165\u7b2c\u4e8c\u4e2a\u4eba\u7684\u4f53\u91cd\uff08\u516c\u65a4\uff09\uff1a&quot;))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u4ee5\u4e0a\u4ee3\u7801\u4e2d\uff0c<code>input()<\/code>\u51fd\u6570\u83b7\u53d6\u7528\u6237\u8f93\u5165\u7684\u4f53\u91cd\u6570\u636e\uff0c<code>float()<\/code>\u51fd\u6570\u5c06\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u6d6e\u70b9\u6570\uff0c\u4ee5\u4fbf\u8fdb\u884c\u6570\u503c\u6bd4\u8f83\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u6bd4\u8f83\u4f53\u91cd<\/h3>\n<\/p>\n<p><p>\u83b7\u53d6\u5e76\u8f6c\u6362\u7528\u6237\u8f93\u5165\u7684\u4f53\u91cd\u6570\u636e\u540e\uff0c\u63a5\u4e0b\u6765\u9700\u8981\u8fdb\u884c\u6bd4\u8f83\u3002Python\u4e2d\u53ef\u4ee5\u4f7f\u7528\u6761\u4ef6\u8bed\u53e5\uff08\u5982if\u3001elif\u3001else\uff09\u6765\u5b9e\u73b0\u5bf9\u4f53\u91cd\u7684\u6bd4\u8f83\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff0c\u6f14\u793a\u5982\u4f55\u6bd4\u8f83\u4e24\u4e2a\u4f53\u91cd\u5e76\u8f93\u51fa\u7ed3\u679c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">if weight1 &gt; weight2:<\/p>\n<p>    print(&quot;\u7b2c\u4e00\u4e2a\u4eba\u7684\u4f53\u91cd\u5927\u4e8e\u7b2c\u4e8c\u4e2a\u4eba\u3002&quot;)<\/p>\n<p>elif weight1 &lt; weight2:<\/p>\n<p>    print(&quot;\u7b2c\u4e8c\u4e2a\u4eba\u7684\u4f53\u91cd\u5927\u4e8e\u7b2c\u4e00\u4e2a\u4eba\u3002&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;\u4e24\u4e2a\u4eba\u7684\u4f53\u91cd\u76f8\u7b49\u3002&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u901a\u8fc7if\u8bed\u53e5\uff0c\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u4f53\u91cd\u7684\u5927\u5c0f\u8f93\u51fa\u76f8\u5e94\u7684\u6587\u672c\u7ed3\u679c\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u5904\u7406\u5f02\u5e38\u60c5\u51b5<\/h3>\n<\/p>\n<p><p>\u7528\u6237\u8f93\u5165\u53ef\u80fd\u4f1a\u5bfc\u81f4\u7a0b\u5e8f\u51fa\u73b0\u5f02\u5e38\uff0c\u4f8b\u5982\u8f93\u5165\u7684\u4e0d\u662f\u6570\u5b57\u3002\u8fd9\u65f6\u53ef\u4ee5\u901a\u8fc7\u5f02\u5e38\u5904\u7406\u673a\u5236\u6765\u589e\u5f3a\u7a0b\u5e8f\u7684\u5065\u58ee\u6027\u3002\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528try-except\u5757\u6765\u6355\u83b7\u548c\u5904\u7406\u5f02\u5e38\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">try:<\/p>\n<p>    weight1 = float(input(&quot;\u8bf7\u8f93\u5165\u7b2c\u4e00\u4e2a\u4eba\u7684\u4f53\u91cd\uff08\u516c\u65a4\uff09\uff1a&quot;))<\/p>\n<p>    weight2 = float(input(&quot;\u8bf7\u8f93\u5165\u7b2c\u4e8c\u4e2a\u4eba\u7684\u4f53\u91cd\uff08\u516c\u65a4\uff09\uff1a&quot;))<\/p>\n<p>except ValueError:<\/p>\n<p>    print(&quot;\u8f93\u5165\u65e0\u6548\uff0c\u8bf7\u8f93\u5165\u6570\u5b57\u3002&quot;)<\/p>\n<p>else:<\/p>\n<p>    if weight1 &gt; weight2:<\/p>\n<p>        print(&quot;\u7b2c\u4e00\u4e2a\u4eba\u7684\u4f53\u91cd\u5927\u4e8e\u7b2c\u4e8c\u4e2a\u4eba\u3002&quot;)<\/p>\n<p>    elif weight1 &lt; weight2:<\/p>\n<p>        print(&quot;\u7b2c\u4e8c\u4e2a\u4eba\u7684\u4f53\u91cd\u5927\u4e8e\u7b2c\u4e00\u4e2a\u4eba\u3002&quot;)<\/p>\n<p>    else:<\/p>\n<p>        print(&quot;\u4e24\u4e2a\u4eba\u7684\u4f53\u91cd\u76f8\u7b49\u3002&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528try-except\u5757\u6765\u6355\u83b7<code>ValueError<\/code>\u5f02\u5e38\uff0c\u4ee5\u4fbf\u5728\u7528\u6237\u8f93\u5165\u7684\u4e0d\u662f\u6570\u5b57\u65f6\u7ed9\u51fa\u53cb\u597d\u7684\u63d0\u793a\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u6269\u5c55\u529f\u80fd<\/h3>\n<\/p>\n<p><p>\u9664\u4e86\u57fa\u672c\u7684\u4f53\u91cd\u6bd4\u8f83\u529f\u80fd\uff0c\u6211\u4eec\u8fd8\u53ef\u4ee5\u6269\u5c55\u7a0b\u5e8f\u4ee5\u5b9e\u73b0\u66f4\u591a\u529f\u80fd\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u5728\u6bd4\u8f83\u591a\u4e2a\u4f53\u91cd\u65f6\u8f93\u51fa\u6700\u5927\u6216\u6700\u5c0f\u503c\uff0c\u6216\u8005\u8ba1\u7b97\u4f53\u91cd\u7684\u5e73\u5747\u503c\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u6269\u5c55\u7684\u793a\u4f8b\uff0c\u6f14\u793a\u5982\u4f55\u8ba1\u7b97\u591a\u4e2a\u8f93\u5165\u4f53\u91cd\u7684\u5e73\u5747\u503c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def calculate_average_weight(weights):<\/p>\n<p>    return sum(weights) \/ len(weights)<\/p>\n<p>weights = []<\/p>\n<p>while True:<\/p>\n<p>    try:<\/p>\n<p>        weight = input(&quot;\u8bf7\u8f93\u5165\u4f53\u91cd\uff08\u8f93\u5165&#39;q&#39;\u9000\u51fa\uff09\uff1a&quot;)<\/p>\n<p>        if weight.lower() == &#39;q&#39;:<\/p>\n<p>            break<\/p>\n<p>        weights.append(float(weight))<\/p>\n<p>    except ValueError:<\/p>\n<p>        print(&quot;\u8f93\u5165\u65e0\u6548\uff0c\u8bf7\u8f93\u5165\u6570\u5b57\u3002&quot;)<\/p>\n<p>if weights:<\/p>\n<p>    average_weight = calculate_average_weight(weights)<\/p>\n<p>    print(f&quot;\u8f93\u5165\u7684\u5e73\u5747\u4f53\u91cd\u4e3a\uff1a{average_weight:.2f} \u516c\u65a4&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(&quot;\u672a\u8f93\u5165\u4efb\u4f55\u4f53\u91cd\u6570\u636e\u3002&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u5b9a\u4e49\u4e86\u4e00\u4e2a\u51fd\u6570<code>calculate_average_weight()<\/code>\u6765\u8ba1\u7b97\u5e73\u5747\u4f53\u91cd\uff0c\u5e76\u4f7f\u7528\u4e00\u4e2a\u5faa\u73af\u6765\u83b7\u53d6\u7528\u6237\u8f93\u5165\u7684\u591a\u4e2a\u4f53\u91cd\u503c\u3002\u7528\u6237\u53ef\u4ee5\u968f\u65f6\u8f93\u5165&#39;q&#39;\u6765\u7ed3\u675f\u8f93\u5165\u8fc7\u7a0b\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u7528\u6237\u754c\u9762\u4e0e\u4ea4\u4e92\u6027<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u63d0\u9ad8\u7528\u6237\u4f53\u9a8c\uff0c\u53ef\u4ee5\u4e3a\u4f53\u91cd\u8f93\u5165\u548c\u6bd4\u8f83\u7a0b\u5e8f\u6dfb\u52a0\u66f4\u52a0\u53cb\u597d\u7684\u7528\u6237\u754c\u9762\u548c\u4ea4\u4e92\u6027\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u884c\u754c\u9762\uff08CLI\uff09\u6216\u56fe\u5f62\u7528\u6237\u754c\u9762\uff08GUI\uff09\u6765\u63d0\u4f9b\u66f4\u76f4\u89c2\u7684\u64cd\u4f5c\u65b9\u5f0f\u3002<\/p>\n<\/p>\n<p><p>\u5728CLI\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u6dfb\u52a0\u989c\u8272\u3001\u683c\u5f0f\u5316\u8f93\u51fa\u7b49\u65b9\u5f0f\u6765\u6539\u5584\u7528\u6237\u4f53\u9a8c\u3002\u5728GUI\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528Python\u7684Tkinter\u3001PyQt\u7b49\u5e93\u6765\u521b\u5efa\u7a97\u53e3\u5e94\u7528\uff0c\u8ba9\u7528\u6237\u901a\u8fc7\u8f93\u5165\u6846\u8f93\u5165\u6570\u636e\u5e76\u901a\u8fc7\u6309\u94ae\u8fdb\u884c\u6bd4\u8f83\u3002<\/p>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4f7f\u7528Tkinter\u521b\u5efa\u7b80\u5355GUI\u7684\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import tkinter as tk<\/p>\n<p>from tkinter import messagebox<\/p>\n<p>def compare_weights():<\/p>\n<p>    try:<\/p>\n<p>        weight1 = float(entry1.get())<\/p>\n<p>        weight2 = float(entry2.get())<\/p>\n<p>        if weight1 &gt; weight2:<\/p>\n<p>            result = &quot;\u7b2c\u4e00\u4e2a\u4eba\u7684\u4f53\u91cd\u5927\u4e8e\u7b2c\u4e8c\u4e2a\u4eba\u3002&quot;<\/p>\n<p>        elif weight1 &lt; weight2:<\/p>\n<p>            result = &quot;\u7b2c\u4e8c\u4e2a\u4eba\u7684\u4f53\u91cd\u5927\u4e8e\u7b2c\u4e00\u4e2a\u4eba\u3002&quot;<\/p>\n<p>        else:<\/p>\n<p>            result = &quot;\u4e24\u4e2a\u4eba\u7684\u4f53\u91cd\u76f8\u7b49\u3002&quot;<\/p>\n<p>        messagebox.showinfo(&quot;\u7ed3\u679c&quot;, result)<\/p>\n<p>    except ValueError:<\/p>\n<p>        messagebox.showerror(&quot;\u9519\u8bef&quot;, &quot;\u8f93\u5165\u65e0\u6548\uff0c\u8bf7\u8f93\u5165\u6570\u5b57\u3002&quot;)<\/p>\n<h2><strong>\u521b\u5efa\u4e3b\u7a97\u53e3<\/strong><\/h2>\n<p>root = tk.Tk()<\/p>\n<p>root.title(&quot;\u4f53\u91cd\u6bd4\u8f83\u5668&quot;)<\/p>\n<h2><strong>\u521b\u5efa\u8f93\u5165\u6846\u548c\u6807\u7b7e<\/strong><\/h2>\n<p>label1 = tk.Label(root, text=&quot;\u7b2c\u4e00\u4e2a\u4eba\u7684\u4f53\u91cd\uff08\u516c\u65a4\uff09\uff1a&quot;)<\/p>\n<p>label1.pack()<\/p>\n<p>entry1 = tk.Entry(root)<\/p>\n<p>entry1.pack()<\/p>\n<p>label2 = tk.Label(root, text=&quot;\u7b2c\u4e8c\u4e2a\u4eba\u7684\u4f53\u91cd\uff08\u516c\u65a4\uff09\uff1a&quot;)<\/p>\n<p>label2.pack()<\/p>\n<p>entry2 = tk.Entry(root)<\/p>\n<p>entry2.pack()<\/p>\n<h2><strong>\u521b\u5efa\u6bd4\u8f83\u6309\u94ae<\/strong><\/h2>\n<p>compare_button = tk.Button(root, text=&quot;\u6bd4\u8f83\u4f53\u91cd&quot;, command=compare_weights)<\/p>\n<p>compare_button.pack()<\/p>\n<h2><strong>\u8fd0\u884c\u4e3b\u5faa\u73af<\/strong><\/h2>\n<p>root.m<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>nloop()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528Tkinter\u5e93\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684GUI\u754c\u9762\uff0c\u7528\u6237\u53ef\u4ee5\u8f93\u5165\u4e24\u4e2a\u4f53\u91cd\u503c\u5e76\u70b9\u51fb\u6309\u94ae\u8fdb\u884c\u6bd4\u8f83\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u6211\u4eec\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u5728Python\u4e2d\u8f93\u5165\u548c\u6bd4\u8f83\u4f53\u91cd\u3002\u8fd9\u5305\u62ec\u4ece\u7528\u6237\u83b7\u53d6\u8f93\u5165\u3001\u5c06\u8f93\u5165\u8f6c\u6362\u4e3a\u9002\u5f53\u7684\u6570\u503c\u7c7b\u578b\u3001\u4f7f\u7528\u6761\u4ef6\u8bed\u53e5\u8fdb\u884c\u6bd4\u8f83\u3001\u5904\u7406\u5f02\u5e38\u60c5\u51b5\u3001\u6269\u5c55\u529f\u80fd\u4ee5\u53ca\u4f7f\u7528GUI\u63d0\u5347\u7528\u6237\u4f53\u9a8c\u3002\u5e0c\u671b\u901a\u8fc7\u8fd9\u4e9b\u8be6\u7ec6\u7684\u6b65\u9aa4\uff0c\u8bfb\u8005\u80fd\u591f\u638c\u63e1\u5982\u4f55\u5728Python\u4e2d\u5b9e\u73b0\u4f53\u91cd\u6bd4\u8f83\u7684\u5b8c\u6574\u8fc7\u7a0b\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u8f93\u5165\u4f53\u91cd\u5e76\u8fdb\u884c\u6bd4\u8f83\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528<code>input()<\/code>\u51fd\u6570\u6765\u83b7\u53d6\u7528\u6237\u8f93\u5165\u7684\u4f53\u91cd\u3002\u63a5\u4e0b\u6765\uff0c\u4f7f\u7528\u7b80\u5355\u7684\u6761\u4ef6\u8bed\u53e5\uff08\u5982<code>if<\/code>\u548c<code>else<\/code>\uff09\u6765\u6bd4\u8f83\u4e0d\u540c\u7684\u4f53\u91cd\u503c\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u5c06\u7528\u6237\u8f93\u5165\u7684\u4f53\u91cd\u4e0e\u4e00\u4e2a\u9884\u8bbe\u7684\u6807\u51c6\u4f53\u91cd\u8fdb\u884c\u6bd4\u8f83\uff0c\u5e76\u7ed9\u51fa\u76f8\u5e94\u7684\u53cd\u9988\u3002<\/p>\n<p><strong>\u53ef\u4ee5\u4f7f\u7528\u54ea\u4e9b\u65b9\u6cd5\u6765\u5904\u7406\u7528\u6237\u8f93\u5165\u7684\u4f53\u91cd\uff1f<\/strong><br \/>\u53ef\u4ee5\u901a\u8fc7<code>input()<\/code>\u51fd\u6570\u83b7\u53d6\u7528\u6237\u7684\u4f53\u91cd\u6570\u636e\uff0c\u8bb0\u5f97\u5c06\u8f93\u5165\u8f6c\u6362\u4e3a\u6d6e\u70b9\u6570\u4ee5\u4fbf\u8fdb\u884c\u6bd4\u8f83\u3002\u4f7f\u7528<code>float()<\/code>\u51fd\u6570\u53ef\u4ee5\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u6570\u5b57\uff0c\u786e\u4fdd\u53ef\u4ee5\u8fdb\u884c\u6570\u5b66\u8fd0\u7b97\u548c\u6bd4\u8f83\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728\u6bd4\u8f83\u4f53\u91cd\u65f6\u63d0\u4f9b\u7528\u6237\u53cb\u597d\u7684\u53cd\u9988\uff1f<\/strong><br \/>\u901a\u8fc7\u6761\u4ef6\u8bed\u53e5\uff0c\u60a8\u53ef\u4ee5\u8bbe\u7f6e\u4e0d\u540c\u7684\u8f93\u51fa\u4fe1\u606f\u3002\u4f8b\u5982\uff0c\u5982\u679c\u7528\u6237\u7684\u4f53\u91cd\u4f4e\u4e8e\u67d0\u4e2a\u6807\u51c6\uff0c\u53ef\u4ee5\u8f93\u51fa\u201c\u60a8\u7684\u4f53\u91cd\u504f\u8f7b\u201d\uff1b\u5982\u679c\u5728\u6807\u51c6\u8303\u56f4\u5185\uff0c\u53ef\u4ee5\u8f93\u51fa\u201c\u60a8\u7684\u4f53\u91cd\u6b63\u5e38\u201d\uff1b\u5982\u679c\u504f\u91cd\uff0c\u5219\u53ef\u4ee5\u63d0\u793a\u201c\u60a8\u7684\u4f53\u91cd\u504f\u91cd\u201d\u3002\u8fd9\u79cd\u65b9\u5f0f\u6709\u52a9\u4e8e\u7528\u6237\u66f4\u597d\u5730\u7406\u89e3\u4ed6\u4eec\u7684\u4f53\u91cd\u72b6\u51b5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\u8f93\u5165\u5e76\u6bd4\u8f83\u4f53\u91cd\u53ef\u4ee5\u901a\u8fc7\u51e0\u79cd\u65b9\u6cd5\u5b9e\u73b0\uff0c\u5305\u62ec\u4f7f\u7528\u5185\u7f6e\u51fd\u6570input()\u83b7\u53d6\u7528\u6237\u8f93\u5165\u3001\u5c06\u8f93\u5165\u6570\u636e\u8f6c\u6362 [&hellip;]","protected":false},"author":3,"featured_media":1015400,"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\/1015396"}],"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=1015396"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1015396\/revisions"}],"predecessor-version":[{"id":1015401,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1015396\/revisions\/1015401"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1015400"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1015396"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1015396"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1015396"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}