{"id":175715,"date":"2022-04-10T10:47:42","date_gmt":"2022-04-10T02:47:42","guid":{"rendered":"http:\/\/www.idc.net\/help\/175715\/"},"modified":"2022-04-10T10:47:42","modified_gmt":"2022-04-10T02:47:42","slug":"%e5%90%8e%e6%b5%aa%e4%ba%91python%e6%95%99%e7%a8%8b%ef%bc%9apython%e9%94%99%e8%af%af%e7%b1%bb%e5%9e%8b%e6%8d%95%e8%8e%b7%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/175715\/","title":{"rendered":"\u540e\u6d6a\u4e91Python\u6559\u7a0b\uff1apython\u9519\u8bef\u7c7b\u578b\u6355\u83b7\u7684\u65b9\u6cd5"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/oss.py.cn\/pycn\/upload\/image\/919\/199\/516\/1622449844574296.png\" class=\"aligncenter\"><\/p>\n<p><strong>\u8bf4\u660e<\/strong><\/p>\n<p>1\u3001\u9047\u5230\u4e0d\u540c\u7c7b\u578b\u7684\u5f02\u5e38\uff0c\u9700\u8981\u9488\u5bf9\u4e0d\u540c\u7c7b\u578b\u7684\u5f02\u5e38\uff0c\u505a\u51fa\u4e0d\u540c\u7684\u54cd\u5e94\uff0c\u8fd9\u65f6\u9700\u8981\u6355\u83b7\u9519\u8bef\u7c7b\u578b\u3002<\/p>\n<p>2\u3001\u5f53Python\u89e3\u91ca\u5668\u629b\u51fa\u5f02\u5e38\u65f6\uff0c\u6700\u540e\u4e00\u884c\u9519\u8bef\u4fe1\u606f\u7684\u7b2c\u4e00\u4e2a\u5355\u8bcd\uff0c\u5c31\u662f\u9519\u8bef\u7c7b\u578b\u3002<\/p>\n<p><strong>\u5b9e\u4f8b<\/strong><\/p>\n<pre>try:\n&nbsp;&nbsp;&nbsp;&nbsp;num&nbsp;=&nbsp;int(input(\"\u8bf7\u8f93\u5165\u6574\u6570\uff1a\"))\n&nbsp;&nbsp;&nbsp;&nbsp;result&nbsp;=&nbsp;8&nbsp;\/&nbsp;num\n&nbsp;&nbsp;&nbsp;&nbsp;print(result)\nexcept&nbsp;ValueError:\n&nbsp;&nbsp;&nbsp;&nbsp;print(\"\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u6574\u6570\")\nexcept&nbsp;ZeroDivisionError:\n&nbsp;&nbsp;&nbsp;&nbsp;print(\"\u9664&nbsp;0&nbsp;\u9519\u8bef\")<\/pre>\n<p>\u4ee5\u4e0a\u5c31\u662fpython\u9519\u8bef\u7c7b\u578b\u6355\u83b7\u7684\u65b9\u6cd5\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\u3002<span>\u66f4\u591aPython\u5b66\u4e60\u6307\u8def\uff1a<\/span>\u540e\u6d6a\u4e91python\u6559\u7a0b<br \/><strong><\/strong><\/p>\n<p><span style=\"font-size: 14px\">\u672c\u6587\u6559\u7a0b\u64cd\u4f5c\u73af\u5883\uff1awindows7\u7cfb\u7edf\u3001Python 3.9.1\uff0cDELL G3\u7535\u8111\u3002<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8bf4\u660e 1\u3001\u9047\u5230\u4e0d\u540c\u7c7b\u578b\u7684\u5f02\u5e38\uff0c\u9700\u8981\u9488\u5bf9\u4e0d\u540c\u7c7b\u578b\u7684\u5f02\u5e38\uff0c\u505a\u51fa\u4e0d\u540c\u7684\u54cd\u5e94\uff0c\u8fd9\u65f6\u9700\u8981\u6355\u83b7\u9519\u8bef\u7c7b\u578b\u3002 2\u3001\u5f53Pytho [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":175716,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[182397],"tags":[],"class_list":["post-175715","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/175715","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=175715"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/175715\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media\/175716"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=175715"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=175715"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=175715"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}