{"id":979309,"date":"2024-12-27T06:45:20","date_gmt":"2024-12-26T22:45:20","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/979309.html"},"modified":"2024-12-27T06:45:22","modified_gmt":"2024-12-26T22:45:22","slug":"python%e5%a6%82%e4%bd%95%e8%be%93%e5%85%a5%e8%ae%a1%e7%ae%97%e5%bc%8f","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/979309.html","title":{"rendered":"python\u5982\u4f55\u8f93\u5165\u8ba1\u7b97\u5f0f"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24205218\/27c8420f-2994-4c22-992e-677d82ddcc55.webp\" alt=\"python\u5982\u4f55\u8f93\u5165\u8ba1\u7b97\u5f0f\" \/><\/p>\n<p><p> <strong>\u5728Python\u4e2d\uff0c\u8f93\u5165\u8ba1\u7b97\u5f0f\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528<code>input()<\/code>\u51fd\u6570\u63a5\u6536\u7528\u6237\u8f93\u5165\u3001\u4f7f\u7528<code>eval()<\/code>\u51fd\u6570\u8ba1\u7b97\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684\u8868\u8fbe\u5f0f\u3001\u4f7f\u7528<code>exec()<\/code>\u6267\u884c\u66f4\u590d\u6742\u7684Python\u4ee3\u7801\u3002<\/strong>\u5177\u4f53\u5b9e\u73b0\u65b9\u6cd5\u5305\u62ec\uff1a\u5b9a\u4e49\u53d8\u91cf\u63a5\u6536\u8f93\u5165\u3001\u786e\u4fdd\u8f93\u5165\u5b89\u5168\u3001\u5229\u7528\u5185\u7f6e\u51fd\u6570\u8fdb\u884c\u8ba1\u7b97\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5176\u4e2d\u4e00\u79cd\u65b9\u6cd5\uff0c<code>eval()<\/code>\u51fd\u6570\u7684\u4f7f\u7528\u3002<\/p>\n<\/p>\n<p><p><code>eval()<\/code>\u51fd\u6570\u662fPython\u4e2d\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u5185\u7f6e\u51fd\u6570\uff0c\u5b83\u80fd\u591f\u89e3\u6790\u5e76\u6267\u884c\u7528\u5b57\u7b26\u4e32\u8868\u793a\u7684Python\u8868\u8fbe\u5f0f\u3002\u4f7f\u7528<code>eval()<\/code>\uff0c\u6211\u4eec\u53ef\u4ee5\u8ba9\u7528\u6237\u8f93\u5165\u4e00\u4e2a\u8ba1\u7b97\u5f0f\uff0c\u7136\u540e\u76f4\u63a5\u8ba1\u7b97\u51fa\u7ed3\u679c\u3002\u4e0d\u8fc7\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c<code>eval()<\/code>\u5728\u5904\u7406\u7528\u6237\u8f93\u5165\u65f6\u5b58\u5728\u4e00\u5b9a\u7684\u5b89\u5168\u98ce\u9669\uff0c\u56e0\u4e3a\u7528\u6237\u53ef\u80fd\u8f93\u5165\u6076\u610f\u4ee3\u7801\u3002\u56e0\u6b64\uff0c\u5728\u4f7f\u7528<code>eval()<\/code>\u65f6\uff0c\u5e94\u8be5\u5bf9\u8f93\u5165\u8fdb\u884c\u4e25\u683c\u7684\u68c0\u67e5\u548c\u9650\u5236\uff0c\u4ee5\u786e\u4fdd\u5b89\u5168\u6027\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u8f93\u5165\u548c\u5904\u7406\u7528\u6237\u8f93\u5165<\/p>\n<\/p>\n<p><p>\u5728Python\u4e2d\uff0c\u7528\u6237\u8f93\u5165\u7684\u5904\u7406\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u8f93\u5165\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684\u8ba1\u7b97\u5f0f<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528<code>input()<\/code>\u51fd\u6570\u6765\u63a5\u6536\u7528\u6237\u8f93\u5165\u3002<code>input()<\/code>\u51fd\u6570\u4f1a\u5c06\u7528\u6237\u8f93\u5165\u7684\u6570\u636e\u4f5c\u4e3a\u5b57\u7b26\u4e32\u8fd4\u56de\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">user_input = input(&quot;\u8bf7\u8f93\u5165\u8ba1\u7b97\u5f0f\uff1a&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b57\u7b26\u4e32\u8f6c\u5316\u4e3a\u8ba1\u7b97\u5f0f<\/strong><\/p>\n<\/p>\n<p><p>\u4e3a\u4e86\u5c06\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684\u8ba1\u7b97\u5f0f\u8f6c\u5316\u4e3a\u53ef\u8ba1\u7b97\u7684\u8868\u8fbe\u5f0f\uff0c\u53ef\u4ee5\u4f7f\u7528<code>eval()<\/code>\u51fd\u6570\u3002\u5b83\u80fd\u591f\u89e3\u6790\u5e76\u6267\u884c\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684Python\u8868\u8fbe\u5f0f\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">result = eval(user_input)<\/p>\n<p>print(&quot;\u8ba1\u7b97\u7ed3\u679c\u662f\uff1a&quot;, result)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u786e\u4fdd\u8f93\u5165\u5b89\u5168<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u4f7f\u7528<code>eval()<\/code>\u51fd\u6570\u65f6\uff0c\u5fc5\u987b\u786e\u4fdd\u8f93\u5165\u7684\u5b89\u5168\u6027\u3002\u53ef\u4ee5\u901a\u8fc7\u9650\u5236\u53ef\u7528\u7684\u51fd\u6570\u548c\u53d8\u91cf\u3001\u5bf9\u8f93\u5165\u8fdb\u884c\u4e25\u683c\u7684\u68c0\u67e5\u548c\u9650\u5236\uff0c\u6765\u63d0\u9ad8\u5b89\u5168\u6027\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u5b9a\u4e49\u5b89\u5168\u7684\u4e0a\u4e0b\u6587<\/p>\n<p><a href=\"https:\/\/docs.pingcode.com\/agile\/agile-at-scale\/what-is-safe\" target=\"_blank\">SAFe<\/a>_globals = {&quot;__builtins__&quot;: None}<\/p>\n<p>safe_locals = {}<\/p>\n<h2><strong>\u8ba1\u7b97\u7ed3\u679c<\/strong><\/h2>\n<p>result = eval(user_input, safe_globals, safe_locals)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u5904\u7406\u4e0d\u540c\u7c7b\u578b\u7684\u8868\u8fbe\u5f0f<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u7b97\u672f\u8868\u8fbe\u5f0f<\/strong><\/p>\n<\/p>\n<p><p>Python\u80fd\u591f\u5904\u7406\u57fa\u672c\u7684\u7b97\u672f\u8868\u8fbe\u5f0f\uff0c\u5305\u62ec\u52a0\u3001\u51cf\u3001\u4e58\u3001\u9664\u3001\u4e58\u65b9\u7b49\u8fd0\u7b97\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">user_input = input(&quot;\u8bf7\u8f93\u5165\u7b97\u672f\u8868\u8fbe\u5f0f\uff1a&quot;)<\/p>\n<p>result = eval(user_input)<\/p>\n<p>print(&quot;\u8ba1\u7b97\u7ed3\u679c\u662f\uff1a&quot;, result)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528\u6570\u5b66\u51fd\u6570<\/strong><\/p>\n<\/p>\n<p><p>\u5982\u679c\u9700\u8981\u4f7f\u7528\u6570\u5b66\u51fd\u6570\uff0c\u5982\u5e73\u65b9\u6839\u3001\u5bf9\u6570\u3001\u4e09\u89d2\u51fd\u6570\u7b49\uff0c\u53ef\u4ee5\u901a\u8fc7\u5bfc\u5165<code>math<\/code>\u6a21\u5757\u5e76\u5728<code>eval()<\/code>\u4e2d\u4f7f\u7528\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import math<\/p>\n<p>user_input = input(&quot;\u8bf7\u8f93\u5165\u6570\u5b66\u8868\u8fbe\u5f0f\uff1a&quot;)<\/p>\n<p>result = eval(user_input, {&quot;__builtins__&quot;: None, &quot;math&quot;: math})<\/p>\n<p>print(&quot;\u8ba1\u7b97\u7ed3\u679c\u662f\uff1a&quot;, result)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5904\u7406\u53d8\u91cf<\/strong><\/p>\n<\/p>\n<p><p>\u5141\u8bb8\u7528\u6237\u8f93\u5165\u5e26\u6709\u53d8\u91cf\u7684\u8ba1\u7b97\u5f0f\u5e76\u5bf9\u5176\u8fdb\u884c\u6c42\u503c\u3002\u9700\u8981\u5148\u5b9a\u4e49\u53d8\u91cf\u53ca\u5176\u503c\uff0c\u7136\u540e\u5728<code>eval()<\/code>\u4e2d\u4f7f\u7528\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">variables = {&quot;x&quot;: 10, &quot;y&quot;: 5}<\/p>\n<p>user_input = input(&quot;\u8bf7\u8f93\u5165\u5e26\u6709\u53d8\u91cf\u7684\u8ba1\u7b97\u5f0f\uff1a&quot;)<\/p>\n<p>result = eval(user_input, {&quot;__builtins__&quot;: None}, variables)<\/p>\n<p>print(&quot;\u8ba1\u7b97\u7ed3\u679c\u662f\uff1a&quot;, result)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u5b89\u5168\u6027\u548c\u5f02\u5e38\u5904\u7406<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u786e\u4fdd\u8f93\u5165\u5b89\u5168<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528<code>eval()<\/code>\u65f6\uff0c\u786e\u4fdd\u4e0d\u5141\u8bb8\u7528\u6237\u6267\u884c\u5371\u9669\u64cd\u4f5c\u3002\u53ef\u4ee5\u901a\u8fc7\u9650\u5236\u5185\u7f6e\u51fd\u6570\u7684\u4f7f\u7528\u6765\u63d0\u9ad8\u5b89\u5168\u6027\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">safe_globals = {&quot;__builtins__&quot;: None}<\/p>\n<p>safe_locals = {&quot;math&quot;: math}<\/p>\n<p>try:<\/p>\n<p>    result = eval(user_input, safe_globals, safe_locals)<\/p>\n<p>    print(&quot;\u8ba1\u7b97\u7ed3\u679c\u662f\uff1a&quot;, result)<\/p>\n<p>except Exception as e:<\/p>\n<p>    print(&quot;\u8f93\u5165\u6709\u8bef\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5f02\u5e38\u5904\u7406<\/strong><\/p>\n<\/p>\n<p><p>\u6355\u83b7\u7528\u6237\u8f93\u5165\u8ba1\u7b97\u5f0f\u65f6\u53ef\u80fd\u51fa\u73b0\u7684\u5f02\u5e38\uff0c\u5982\u8bed\u6cd5\u9519\u8bef\u3001\u6570\u5b66\u8fd0\u7b97\u9519\u8bef\u7b49\uff0c\u907f\u514d\u7a0b\u5e8f\u5d29\u6e83\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">try:<\/p>\n<p>    result = eval(user_input)<\/p>\n<p>    print(&quot;\u8ba1\u7b97\u7ed3\u679c\u662f\uff1a&quot;, result)<\/p>\n<p>except SyntaxError:<\/p>\n<p>    print(&quot;\u8f93\u5165\u7684\u8ba1\u7b97\u5f0f\u683c\u5f0f\u6709\u8bef\uff0c\u8bf7\u68c0\u67e5\u3002&quot;)<\/p>\n<p>except Exception as e:<\/p>\n<p>    print(&quot;\u51fa\u73b0\u9519\u8bef\uff1a&quot;, e)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u5e94\u7528\u573a\u666f<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u547d\u4ee4\u884c\u8ba1\u7b97\u5668<\/strong><\/p>\n<\/p>\n<p><p>\u53ef\u4ee5\u901a\u8fc7\u4e0a\u8ff0\u65b9\u6cd5\u5b9e\u73b0\u4e00\u4e2a\u7b80\u5355\u7684\u547d\u4ee4\u884c\u8ba1\u7b97\u5668\uff0c\u7528\u6237\u53ef\u4ee5\u8f93\u5165\u4efb\u610f\u5408\u6cd5\u7684Python\u8868\u8fbe\u5f0f\u8fdb\u884c\u8ba1\u7b97\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def calculator():<\/p>\n<p>    while True:<\/p>\n<p>        try:<\/p>\n<p>            user_input = input(&quot;\u8bf7\u8f93\u5165\u8ba1\u7b97\u5f0f\uff08\u8f93\u5165&#39;\u9000\u51fa&#39;\u7ed3\u675f\uff09\uff1a&quot;)<\/p>\n<p>            if user_input.lower() == &#39;\u9000\u51fa&#39;:<\/p>\n<p>                break<\/p>\n<p>            result = eval(user_input)<\/p>\n<p>            print(&quot;\u8ba1\u7b97\u7ed3\u679c\u662f\uff1a&quot;, result)<\/p>\n<p>        except Exception as e:<\/p>\n<p>            print(&quot;\u8f93\u5165\u6709\u8bef\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002&quot;)<\/p>\n<p>calculator()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u79d1\u5b66\u8ba1\u7b97<\/strong><\/p>\n<\/p>\n<p><p>\u9488\u5bf9\u590d\u6742\u7684\u79d1\u5b66\u8ba1\u7b97\uff0c\u53ef\u4ee5\u7ed3\u5408<code>math<\/code>\u6a21\u5757\u7684\u51fd\u6570\uff0c\u5728<code>eval()<\/code>\u4e2d\u8fdb\u884c\u66f4\u590d\u6742\u7684\u8868\u8fbe\u5f0f\u6c42\u89e3\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import math<\/p>\n<p>def scientific_calculator():<\/p>\n<p>    while True:<\/p>\n<p>        try:<\/p>\n<p>            user_input = input(&quot;\u8bf7\u8f93\u5165\u79d1\u5b66\u8ba1\u7b97\u5f0f\uff08\u8f93\u5165&#39;\u9000\u51fa&#39;\u7ed3\u675f\uff09\uff1a&quot;)<\/p>\n<p>            if user_input.lower() == &#39;\u9000\u51fa&#39;:<\/p>\n<p>                break<\/p>\n<p>            result = eval(user_input, {&quot;__builtins__&quot;: None, &quot;math&quot;: math})<\/p>\n<p>            print(&quot;\u8ba1\u7b97\u7ed3\u679c\u662f\uff1a&quot;, result)<\/p>\n<p>        except Exception as e:<\/p>\n<p>            print(&quot;\u8f93\u5165\u6709\u8bef\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002&quot;)<\/p>\n<p>scientific_calculator()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u603b\u7ed3<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u4f7f\u7528Python\u7684<code>input()<\/code>\u548c<code>eval()<\/code>\u51fd\u6570\uff0c\u80fd\u591f\u65b9\u4fbf\u5730\u5b9e\u73b0\u7528\u6237\u8f93\u5165\u8ba1\u7b97\u5f0f\u5e76\u8fdb\u884c\u6c42\u503c\u7684\u529f\u80fd\u3002\u5728\u5b9e\u73b0\u8fc7\u7a0b\u4e2d\uff0c\u9700\u8981\u7279\u522b\u6ce8\u610f\u8f93\u5165\u7684\u5b89\u5168\u6027\u548c\u5f02\u5e38\u5904\u7406\uff0c\u786e\u4fdd\u7a0b\u5e8f\u7684\u7a33\u5b9a\u6027\u548c\u5b89\u5168\u6027\u3002\u901a\u8fc7\u7ed3\u5408Python\u7684\u6570\u5b66\u6a21\u5757\uff0c\u8fd8\u53ef\u4ee5\u5b9e\u73b0\u66f4\u52a0\u590d\u6742\u7684\u79d1\u5b66\u8ba1\u7b97\u529f\u80fd\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u8f93\u5165\u548c\u8ba1\u7b97\u6570\u5b66\u8868\u8fbe\u5f0f\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u7528\u6237\u53ef\u4ee5\u901a\u8fc7<code>input()<\/code>\u51fd\u6570\u63a5\u6536\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684\u6570\u5b66\u8868\u8fbe\u5f0f\uff0c\u7136\u540e\u4f7f\u7528<code>eval()<\/code>\u51fd\u6570\u5c06\u5176\u8ba1\u7b97\u4e3a\u6570\u503c\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u4f7f\u7528<code>eval()<\/code>\u65f6\u8981\u5c0f\u5fc3\u8f93\u5165\u7684\u5b89\u5168\u6027\uff0c\u4ee5\u9632\u6b62\u6267\u884c\u6076\u610f\u4ee3\u7801\u3002<\/p>\n<p><strong>\u662f\u5426\u6709\u5176\u4ed6\u65b9\u6cd5\u53ef\u4ee5\u5b9e\u73b0\u6570\u5b66\u8868\u8fbe\u5f0f\u7684\u8ba1\u7b97\uff1f<\/strong><br \/>\u9664\u4e86\u4f7f\u7528<code>eval()<\/code>\uff0cPython\u8fd8\u63d0\u4f9b\u4e86<code>sympy<\/code>\u5e93\uff0c\u8fd9\u4e2a\u5e93\u4e13\u95e8\u7528\u4e8e\u7b26\u53f7\u6570\u5b66\uff0c\u80fd\u591f\u5b89\u5168\u5730\u5904\u7406\u548c\u8ba1\u7b97\u8868\u8fbe\u5f0f\u3002\u4f7f\u7528<code>sympy.sympify()<\/code>\u51fd\u6570\uff0c\u53ef\u4ee5\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u7b26\u53f7\u8868\u8fbe\u5f0f\u5e76\u8fdb\u884c\u8ba1\u7b97\uff0c\u8fd9\u6837\u66f4\u52a0\u5b89\u5168\u4e14\u7075\u6d3b\u3002<\/p>\n<p><strong>\u5982\u4f55\u5904\u7406\u7528\u6237\u8f93\u5165\u7684\u9519\u8bef\u6216\u8005\u65e0\u6548\u7684\u6570\u5b66\u8868\u8fbe\u5f0f\uff1f<\/strong><br \/>\u5728\u63a5\u6536\u7528\u6237\u8f93\u5165\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f02\u5e38\u5904\u7406\u673a\u5236\u6765\u6355\u83b7\u53ef\u80fd\u51fa\u73b0\u7684\u9519\u8bef\u3002\u4f8b\u5982\uff0c\u4f7f\u7528<code>try...except<\/code>\u7ed3\u6784\u53ef\u4ee5\u6709\u6548\u5730\u6355\u83b7<code>SyntaxError<\/code>\u6216<code>NameError<\/code>\u7b49\u5f02\u5e38\uff0c\u8fd9\u6837\u53ef\u4ee5\u63d0\u793a\u7528\u6237\u91cd\u65b0\u8f93\u5165\u6709\u6548\u7684\u6570\u5b66\u8868\u8fbe\u5f0f\uff0c\u589e\u5f3a\u7a0b\u5e8f\u7684\u5065\u58ee\u6027\u548c\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n<p><strong>\u662f\u5426\u53ef\u4ee5\u9650\u5236\u8f93\u5165\u7684\u6570\u5b66\u8868\u8fbe\u5f0f\u7684\u590d\u6742\u5ea6\uff1f<\/strong><br \/>\u53ef\u4ee5\u901a\u8fc7\u6b63\u5219\u8868\u8fbe\u5f0f\u6216\u81ea\u5b9a\u4e49\u51fd\u6570\u5bf9\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u8fdb\u884c\u9a8c\u8bc1\uff0c\u4ee5\u786e\u4fdd\u7528\u6237\u8f93\u5165\u7684\u6570\u5b66\u8868\u8fbe\u5f0f\u7b26\u5408\u4e00\u5b9a\u7684\u683c\u5f0f\u8981\u6c42\u3002\u8fd9\u79cd\u65b9\u6cd5\u80fd\u591f\u6709\u6548\u907f\u514d\u4e00\u4e9b\u4e0d\u5fc5\u8981\u7684\u9519\u8bef\u8f93\u5165\uff0c\u4ece\u800c\u63d0\u9ad8\u7a0b\u5e8f\u7684\u51c6\u786e\u6027\u548c\u5b89\u5168\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python\u4e2d\uff0c\u8f93\u5165\u8ba1\u7b97\u5f0f\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528input()\u51fd\u6570\u63a5\u6536\u7528\u6237\u8f93\u5165\u3001\u4f7f\u7528eval()\u51fd\u6570\u8ba1\u7b97\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684\u8868 [&hellip;]","protected":false},"author":3,"featured_media":979313,"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\/979309"}],"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=979309"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/979309\/revisions"}],"predecessor-version":[{"id":979315,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/979309\/revisions\/979315"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/979313"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=979309"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=979309"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=979309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}