{"id":1648,"date":"2022-01-08T17:22:09","date_gmt":"2022-01-08T09:22:09","guid":{"rendered":"http:\/\/139.9.1.231\/?p=1648"},"modified":"2022-01-08T17:22:10","modified_gmt":"2022-01-08T09:22:10","slug":"quzheng","status":"publish","type":"post","link":"http:\/\/139.9.1.231\/index.php\/2022\/01\/08\/quzheng\/","title":{"rendered":"python\u4e2d\u7684\u53d6\u6574:"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<ol><li>\u5411\u4e0a\u53d6\u6574\uff1amath.ceil()<\/li><li>\u5411\u4e0b\u53d6\u6574\uff1amath.floor()\u3001\u6574\u9664&#8221;\/\/&#8221;<\/li><li>\u56db\u820d\u4e94\u5165\uff1around()\u2014\u2014<strong>\u5947\u6570\u5411\u8fdc\u79bb0\u53d6\u6574\uff0c\u5076\u6570\u53bb\u5c3e\u53d6\u6574\uff1b\u6216\u8a00\u4e4b\uff1a\u5947\u6570\u8fdb\u4f4d\uff0c\u5076\u6570\u53bb\u5c3e<\/strong><\/li><li>\u54110\u53d6\u6574\uff1aint()<\/li><\/ol>\n\n\n\n<ul class=\"has-light-pink-background-color has-background\"><li>\u5411\u4e0a\u53d6\u6574\uff1amath.ceil()<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>import math\r\r\nmath.ceil(-0.5)\r\n>>> 0\r\n \r\nmath.ceil(-0.9)\r\n>>> 0\r\n\r\nmath.ceil(0.3)\r\n>>> 1<\/code><\/pre>\n\n\n\n<p class=\"has-light-pink-background-color has-background\"><li>\u5411\u4e0b\u53d6\u6574\uff1amath.floor()\u3001\u6574\u9664&#8221;\/\/&#8221;<\/li><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\r\nmath.floor(-0.3)\r\n>>> -1\r\n \r\nmath.floor(0.9)\r\n>>> 0\n\r\n\r\n(-1) \/\/ 2  # -0.5\r\n>>> -1\r\n \r\n(-3) \/\/ 2  # -1.5\r\n>>> -2\r\n \r\n1 \/\/ 2    # 0.5 \r\n>>> 0\r\n \r\n3 \/\/ 2    # 1.5\r\n<\/code><\/pre>\n\n\n\n<p class=\"has-light-gray-background-color has-background\">int()<\/p>\n\n\n\n<p><code>int(-0.5)>>> 0 int(-0.9)>>> 0 int(0.5)>>> 0 int(0.9)>>> 0<\/code>\u4e00\u53e5\u8bdd\u603b\u7ed3\uff1aint()\u51fd\u6570\u662f\u201c\u54110\u53d6\u6574\u201d\uff0c\u53d6\u6574\u65b9\u5411\u603b\u662f\u8ba9\u7ed3\u679c\u6bd4\u5c0f\u6570\u7684\u7edd\u5bf9\u503c\u66f4\u5c0f<\/p>\n\n\n\n<p class=\"has-light-pink-background-color has-background\"><li>round()<\/li><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\r\nround(-2.5)\r\n>>> -2\r\n \r\nround(-1.5)\r\n>>> -2\r\n \r\nround(-0.5)\r\n>>> 0\r\n \r\nround(0.5)\r\n>>> 0\r\n \r\nround(1.5)\r\n>>> 2\r\n \r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5411\u4e0a\u53d6\u6574\uff1amath.ceil() \u5411\u4e0b\u53d6\u6574\uff1amath.floor()\u3001\u6574\u9664&#8221;\/\/&#8221; \u56db &hellip; <a href=\"http:\/\/139.9.1.231\/index.php\/2022\/01\/08\/quzheng\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">python\u4e2d\u7684\u53d6\u6574:<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[8],"tags":[],"_links":{"self":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/1648"}],"collection":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/comments?post=1648"}],"version-history":[{"count":4,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/1648\/revisions"}],"predecessor-version":[{"id":1652,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/1648\/revisions\/1652"}],"wp:attachment":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/media?parent=1648"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/categories?post=1648"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/tags?post=1648"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}