{"id":179996,"date":"2024-05-08T20:26:04","date_gmt":"2024-05-08T12:26:04","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/179996.html"},"modified":"2024-05-08T20:26:16","modified_gmt":"2024-05-08T12:26:16","slug":"python-%e4%b8%ba%e4%bd%95%e7%94%a81-0%e5%8e%bb%e4%b9%98%e4%b8%80%e4%b8%aa%e6%95%b0","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/179996.html","title":{"rendered":"python \u4e3a\u4f55\u75281.0\u53bb\u4e58\u4e00\u4e2a\u6570"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/27064955\/3519554a-89d7-4841-92e6-da46866cb205.webp\" alt=\"python \u4e3a\u4f55\u75281.0\u53bb\u4e58\u4e00\u4e2a\u6570\" \/><\/p>\n<p><p><strong>Python\u4e2d\u4f7f\u75281.0\u53bb\u4e58\u4ee5\u4e00\u4e2a\u6570\u7684\u64cd\u4f5c\u901a\u5e38\u662f\u4e3a\u4e86\u5c06\u6574\u6570\u8f6c\u6362\u4e3a\u6d6e\u70b9\u6570\u3001\u4fdd\u8bc1\u6d6e\u70b9\u6570\u8fd0\u7b97\u7684\u7cbe\u5ea6\uff0c\u4ee5\u53ca\u9075\u5faa\u7b97\u672f\u8fd0\u7b97\u7684\u9690\u5f0f\u7c7b\u578b\u8f6c\u6362\u89c4\u5219\u3002<\/strong> \u5f53\u4e00\u4e2a\u6574\u6570\u4e0e\u4e00\u4e2a\u6d6e\u70b9\u6570\u76f8\u4e58\u65f6\uff0c\u6574\u6570\u5c06\u88ab\u81ea\u52a8\u8f6c\u6362\u4e3a\u6d6e\u70b9\u6570\uff0c\u7ed3\u679c\u4e5f\u5c06\u662f\u6d6e\u70b9\u6570\u3002\u8fd9\u5728\u9700\u8981\u6d6e\u70b9\u6570\u9664\u6cd5\u7ed3\u679c\u6216\u8fdb\u884c\u7cbe\u5ea6\u654f\u611f\u7684\u6570\u5b66\u8fd0\u7b97\u65f6\u5c24\u4e3a\u91cd\u8981\u3002<\/p>\n<\/p>\n<p><p>\u5728\u6df1\u5165\u6d6e\u70b9\u6570\u7684\u91cd\u8981\u6027\u524d\uff0c\u9996\u5148\u7406\u89e3Python\u4e2d\u7684\u6570\u5b57\u7c7b\u578b\u662f\u6709\u76ca\u7684\u3002Python\u652f\u6301\u6574\u578b\uff08<code>int<\/code>\uff09\u548c\u6d6e\u70b9\u578b\uff08<code>float<\/code>\uff09\u6570\u5b57\u3002\u6574\u578b\u662f\u4e0d\u5e26\u5c0f\u6570\u70b9\u7684\u7eaf\u6570\u5b57\uff0c\u800c\u6d6e\u70b9\u578b\u5219\u5305\u542b\u5c0f\u6570\u90e8\u5206\u3002\u67d0\u4e9b\u5e94\u7528\u573a\u666f\uff0c\u5c24\u5176\u662f\u6570\u5b66\u548c\u79d1\u5b66\u8ba1\u7b97\uff0c\u5bf9\u6570\u5b57\u7684\u7cbe\u5ea6\u548c\u8868\u8fbe\u6709\u7279\u6b8a\u8981\u6c42\uff0c\u8fd9\u65f6\u5019\u901a\u5e38\u4f7f\u7528\u6d6e\u70b9\u6570\u6765\u8fdb\u884c\u8ba1\u7b97\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u6570\u636e\u7c7b\u578b\u8f6c\u6362<\/h3>\n<\/p>\n<p><p>\u5728\u8fdb\u884c\u6570\u5b66\u8ba1\u7b97\u65f6\uff0c\u4e86\u89e3\u5e76\u6b63\u786e\u5904\u7406\u6570\u636e\u7c7b\u578b\u81f3\u5173\u91cd\u8981\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cPython\u4e2d\u7684\u9664\u6cd5\u64cd\u4f5c\u83b7\u5f97\u7684\u7ed3\u679c\u662f\u6d6e\u70b9\u6570\uff0c\u5373\u4f7f\u4e24\u4e2a\u8fd0\u7b97\u6570\u90fd\u662f\u6574\u6570\u3002\u7136\u800c\uff0c\u5176\u4ed6\u8fd0\u7b97\u5982\u4e58\u6cd5\u548c\u52a0\u6cd5\uff0c\u5219\u9075\u5faa\u4e0d\u540c\u7684\u7c7b\u578b\u8f6c\u6362\u89c4\u5219\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u6574\u6570\u4e0e\u6d6e\u70b9\u6570\u7684\u4e58\u6cd5<\/strong>\uff1a<\/p>\n<p>\u5f53\u6574\u6570\u4e0e\u6d6e\u70b9\u6570\u76f8\u4e58\u65f6\uff0c\u7ed3\u679c\u81ea\u52a8\u8f6c\u6362\u6210\u6d6e\u70b9\u6570\u3002\u8fd9\u662f\u56e0\u4e3aPython\u9075\u5faa\u4e00\u79cd\u79f0\u4e3a&quot;\u5bbd\u5316&quot;(widening)\u7684\u7c7b\u578b\u8f6c\u6362\u539f\u5219\uff0c\u6839\u636e\u8be5\u539f\u5219\uff0c\u6574\u6570\u5bbd\u5316\u5230\u6d6e\u70b9\u6570\u800c\u4e0d\u4f1a\u4e22\u5931\u4fe1\u606f\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u786e\u4fdd\u8ba1\u7b97\u7ed3\u679c\u4e3a\u6d6e\u70b9\u6570<\/strong>\uff1a<\/p>\n<p>\u4e58\u4ee51.0\u662f\u786e\u4fdd\u6d89\u53ca\u6574\u6570\u7684\u8fd0\u7b97\u6700\u7ec8\u7ed3\u679c\u4e3a\u6d6e\u70b9\u7c7b\u578b\u7684\u7b80\u4fbf\u65b9\u6cd5\u3002\u7279\u522b\u662f\u5728\u65e7\u7248\u672c\u7684Python\u4e2d\uff0c\u6574\u6570\u9664\u6cd5\u4f1a\u9ed8\u8ba4\u5f97\u5230\u6574\u6570\u7ed3\u679c\uff0c\u9664\u975e\u7279\u610f\u5c06\u5176\u4e2d\u4e00\u4e2a\u64cd\u4f5c\u6570\u8f6c\u6362\u4e3a\u6d6e\u70b9\u6570\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e8c\u3001\u6d6e\u70b9\u6570\u8fd0\u7b97\u7684\u7cbe\u5ea6<\/h3>\n<\/p>\n<p><p>\u6d6e\u70b9\u6570\u8fd0\u7b97\u56e0\u5176\u5185\u90e8\u8868\u793a\u548c\u6709\u9650\u7684\u7cbe\u5ea6\u95ee\u9898\u800c\u590d\u6742\u3002\u4f7f\u7528\u6d6e\u70b9\u6570\u53ef\u4ee5\u83b7\u5f97\u6bd4\u6574\u6570\u66f4\u7cbe\u786e\u7684\u7ed3\u679c\uff0c\u7279\u522b\u662f\u5728\u79d1\u5b66\u8ba1\u7b97\u548c\u5de5\u7a0b\u9886\u57df\uff0c\u7cbe\u5ea6\u662f\u4e00\u4e2a\u975e\u5e38\u5173\u952e\u7684\u56e0\u7d20\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5904\u7406\u7cbe\u5ea6\u8981\u6c42<\/strong>\uff1a<\/p>\n<p>\u5728\u9700\u8981\u9ad8\u7cbe\u5ea6\u7684\u8fd0\u7b97\u4e2d\uff0c\u5c06\u6574\u6570\u5148\u8f6c\u6362\u4e3a\u6d6e\u70b9\u6570\u80fd\u591f\u907f\u514d\u7cbe\u5ea6\u635f\u5931\u3002\u4f8b\u5982\uff0c\u5728\u5904\u7406\u8d27\u5e01\u6216\u8005\u590d\u6742\u7684\u79d1\u5b66\u8ba1\u7b97\u65f6\uff0c\u5c31\u9700\u8981\u8fd9\u79cd\u8f6c\u6362\u6765\u4fdd\u8bc1\u7ed3\u679c\u7684\u7cbe\u786e\u6027\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u907f\u514d\u6574\u6570\u6ea2\u51fa<\/strong>\uff1a<\/p>\n<p>\u5728\u67d0\u4e9b\u7f16\u7a0b\u8bed\u8a00\u4e2d\uff0c\u8fc7\u5927\u7684\u6574\u6570\u4e58\u6cd5\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6574\u6570\u6ea2\u51fa\uff0c\u5bfc\u81f4\u9519\u8bef\u7684\u7ed3\u679c\u3002\u901a\u8fc7\u8f6c\u6362\u4e3a\u6d6e\u70b9\u6570\u8fdb\u884c\u4e58\u6cd5\u8fd0\u7b97\uff0c\u53ef\u4ee5\u907f\u514d\u8fd9\u79cd\u6ea2\u51fa\u7684\u98ce\u9669\u3002\u867d\u7136Python\u7684\u6574\u6570\u7c7b\u578b\u6ca1\u6709\u56fa\u5b9a\u7684\u5927\u5c0f\u9650\u5236\uff0c\u4f46\u662f\u5bf9\u4e8e\u67d0\u4e9b\u7279\u5b9a\u7684\u5e94\u7528\u6216\u8005\u8bed\u8a00\u8f6c\u6362\uff0c\u8003\u8651\u6574\u6570\u6ea2\u51fa\u4ecd\u7136\u662f\u4e2a\u597d\u4e60\u60ef\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e09\u3001\u9690\u5f0f\u7c7b\u578b\u8f6c\u6362\u89c4\u5219<\/h3>\n<\/p>\n<p><p>Python\u5728\u6267\u884c\u7b97\u672f\u8fd0\u7b97\u65f6\uff0c\u9075\u5faa\u4e00\u5957\u5185\u7f6e\u7684\u7c7b\u578b\u8f6c\u6362\u89c4\u5219\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u9690\u5f0f\u7c7b\u578b\u63d0\u5347<\/strong>\uff1a<\/p>\n<p>\u5f53\u6df7\u5408\u4f7f\u7528\u4e0d\u540c\u7684\u6570\u5b57\u7c7b\u578b\u65f6\uff0cPython\u901a\u5e38\u5c06\u8fd0\u7b97\u6570\u63d0\u5347\u5230\u6700\u4e3a\u590d\u6742\u7684\u7c7b\u578b\u3002\u8fd9\u610f\u5473\u7740\u5f53\u6574\u6570\u4e0e\u6d6e\u70b9\u6570\u5171\u540c\u53c2\u4e0e\u8fd0\u7b97\u65f6\uff0c\u6574\u6570\u4f1a\u88ab\u9690\u5f0f\u5730\u8f6c\u6362\u4e3a\u6d6e\u70b9\u6570\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7ef4\u6301\u4e00\u81f4\u6027\u548c\u6570\u5b66\u89c4\u5219<\/strong>\uff1a<\/p>\n<p>\u4f7f\u75281.0\u4e58\u4ee5\u6570\u503c\u53ef\u4ee5\u786e\u4fdd\u7ed3\u679c\u7684\u7c7b\u578b\u548c\u7cbe\u786e\u5ea6\u7b26\u5408\u6570\u5b66\u8fd0\u7b97\u539f\u5219\u3002\u8003\u8651\u5230Python\u4e2d\u6574\u6570\u9664\u6cd5\u7684\u884c\u4e3a\uff0c\u8fd9\u79cd\u65b9\u6cd5\u53ef\u4ee5\u5728\u4e0d\u6539\u53d8\u4ee3\u7801\u903b\u8f91\u7684\u524d\u63d0\u4e0b\u7b80\u5316\u4ee3\u7801\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u7efc\u4e0a\u6240\u8ff0\uff0c1.0\u4e58\u4ee5\u4e00\u4e2a\u6570\u662f\u4e00\u79cd\u786e\u4fdd\u6d6e\u70b9\u6570\u8fd0\u7b97\u7cbe\u5ea6\u548c\u89c4\u907f\u6570\u636e\u7c7b\u578b\u5e26\u6765\u95ee\u9898\u7684\u6709\u6548\u7b56\u7565\u3002\u5c3d\u7ba1Python\u63d0\u4f9b\u4e86\u81ea\u52a8\u7c7b\u578b\u8f6c\u6362\uff0c\u660e\u786e\u5730\u8f6c\u6362\u6570\u636e\u7c7b\u578b\uff0c\u65e0\u8bba\u662f\u901a\u8fc7\u76f4\u63a5\u7684\u4e58\u4ee51.0\u8fd8\u662f\u4f7f\u7528\u7c7b\u578b\u8f6c\u6362\u51fd\u6570\uff08\u5982<code>float()<\/code>\uff09\uff0c\u53ef\u4ee5\u589e\u52a0\u4ee3\u7801\u7684\u6e05\u6670\u5ea6\u548c\u5065\u58ee\u6027\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>\u4e3a\u4ec0\u4e48 Python \u4e2d\u4f7f\u7528 1.0 \u4e58\u4ee5\u4e00\u4e2a\u6570\uff1f<\/strong><\/p>\n<p><strong>1.0 \u5728 Python \u4e2d\u4e58\u4ee5\u4e00\u4e2a\u6570\u5b57\u6709\u4ec0\u4e48\u7279\u6b8a\u542b\u4e49\uff1f<\/strong><\/p>\n<p><strong>Python \u4e2d\u4e3a\u4ec0\u4e48\u7ecf\u5e38\u4f7f\u7528 1.0 \u8fdb\u884c\u6570\u503c\u8fd0\u7b97\uff1f<\/strong><\/p>\n<p>\u7b54\uff1a<\/p>\n<ol>\n<li>\n<p>\u9996\u5148\uff0cPython \u4e2d\u4f7f\u7528 1.0 \u4e58\u4ee5\u4e00\u4e2a\u6570\u662f\u4e3a\u4e86\u5c06\u5176\u8f6c\u6362\u4e3a\u6d6e\u70b9\u6570\u3002\u5728\u8ba1\u7b97\u673a\u7f16\u7a0b\u4e2d\uff0c\u6709\u65f6\u6211\u4eec\u9700\u8981\u786e\u4fdd\u6570\u503c\u7684\u7cbe\u5ea6\u548c\u7c7b\u578b\u662f\u6b63\u786e\u7684\u3002\u4f7f\u7528 1.0 \u4e58\u4ee5\u4e00\u4e2a\u6574\u6570\u6216\u5176\u4ed6\u6570\u5b57\uff0c\u53ef\u4ee5\u5c06\u5176\u8f6c\u6362\u4e3a\u6d6e\u70b9\u6570\uff0c\u4ee5\u4fbf\u8fdb\u884c\u7cbe\u786e\u7684\u8ba1\u7b97\u548c\u907f\u514d\u6574\u6570\u9664\u6cd5\u7684\u622a\u65ad\u8bef\u5dee\u3002<\/p>\n<\/li>\n<li>\n<p>\u5176\u6b21\uff0c1.0 \u5728 Python \u4e2d\u4e58\u4ee5\u4e00\u4e2a\u6570\u5b57\u901a\u5e38\u7528\u4e8e\u5b9e\u73b0\u6bd4\u4f8b\u6216\u767e\u5206\u6bd4\u8ba1\u7b97\u3002\u4f8b\u5982\uff0c\u5982\u679c\u6211\u4eec\u60f3\u8ba1\u7b97\u67d0\u4e2a\u6570\u503c\u5360\u603b\u6570\u7684\u767e\u5206\u6bd4\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u8be5\u6570\u503c\u4e58\u4ee5 1.0\uff0c\u7136\u540e\u9664\u4ee5\u603b\u6570\uff0c\u5f97\u5230\u4e00\u4e2a\u6d6e\u70b9\u6570\u8868\u793a\u7684\u767e\u5206\u6bd4\u3002<\/p>\n<\/li>\n<li>\n<p>\u6b64\u5916\uff0c\u4f7f\u7528 1.0 \u8fdb\u884c\u6570\u503c\u8fd0\u7b97\u8fd8\u53ef\u4ee5\u5b9e\u73b0\u7c7b\u578b\u8f6c\u6362\u3002\u4f8b\u5982\uff0c\u5982\u679c\u6211\u4eec\u5e0c\u671b\u5c06\u4e00\u4e2a\u6574\u6570\u6216\u5176\u4ed6\u7c7b\u578b\u7684\u6570\u5b57\u8f6c\u6362\u4e3a\u6d6e\u70b9\u6570\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u5176\u4e0e 1.0 \u76f8\u4e58\u3002\u8fd9\u53ef\u4ee5\u7528\u4e8e\u6267\u884c\u67d0\u4e9b\u7279\u5b9a\u7684\u6570\u5b66\u8fd0\u7b97\uff0c\u6216\u8005\u5728\u5904\u7406\u6570\u636e\u65f6\u786e\u4fdd\u4e00\u81f4\u7684\u7c7b\u578b\u3002<\/p>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"Python\u4e2d\u4f7f\u75281.0\u53bb\u4e58\u4ee5\u4e00\u4e2a\u6570\u7684\u64cd\u4f5c\u901a\u5e38\u662f\u4e3a\u4e86\u5c06\u6574\u6570\u8f6c\u6362\u4e3a\u6d6e\u70b9\u6570\u3001\u4fdd\u8bc1\u6d6e\u70b9\u6570\u8fd0\u7b97\u7684\u7cbe\u5ea6\uff0c\u4ee5\u53ca\u9075\u5faa\u7b97\u672f\u8fd0\u7b97 [&hellip;]","protected":false},"author":3,"featured_media":180012,"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\/179996"}],"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=179996"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/179996\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/180012"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=179996"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=179996"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=179996"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}