{"id":1132327,"date":"2025-01-08T20:56:05","date_gmt":"2025-01-08T12:56:05","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1132327.html"},"modified":"2025-01-08T20:56:07","modified_gmt":"2025-01-08T12:56:07","slug":"python%e5%a6%82%e4%bd%95%e8%ae%a1%e7%ae%97%e5%b0%8f%e6%95%b0%e7%82%b9%e5%90%8e%e4%b8%a4%e4%bd%8d","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1132327.html","title":{"rendered":"python\u5982\u4f55\u8ba1\u7b97\u5c0f\u6570\u70b9\u540e\u4e24\u4f4d"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25101915\/347be459-7850-4f8a-b3bb-c91587914acc.webp\" alt=\"python\u5982\u4f55\u8ba1\u7b97\u5c0f\u6570\u70b9\u540e\u4e24\u4f4d\" \/><\/p>\n<p><p> <strong>Python\u5982\u4f55\u8ba1\u7b97\u5c0f\u6570\u70b9\u540e\u4e24\u4f4d\uff0c\u4f7f\u7528\u5185\u7f6e\u51fd\u6570round()\u3001\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\u3001Decimal\u7c7b<\/strong><\/p>\n<\/p>\n<p><p>Python \u63d0\u4f9b\u4e86\u591a\u79cd\u65b9\u6cd5\u6765\u8ba1\u7b97\u548c\u5904\u7406\u5c0f\u6570\u70b9\u540e\u4e24\u4f4d\uff0c\u5305\u62ec\u4f7f\u7528\u5185\u7f6e\u7684 <code>round()<\/code> \u51fd\u6570\u3001\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\u4ee5\u53ca <code>Decimal<\/code> \u7c7b\u3002\u4f7f\u7528 <code>round()<\/code> \u51fd\u6570\u662f\u6700\u76f4\u63a5\u7684\u65b9\u6cd5\uff0c\u5b83\u53ef\u4ee5\u7b80\u5355\u5730\u5c06\u6570\u5b57\u56db\u820d\u4e94\u5165\u5230\u6307\u5b9a\u7684\u5c0f\u6570\u4f4d\u6570\u3002\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\u5219\u53ef\u4ee5\u8ba9\u4f60\u5728\u8f93\u51fa\u65f6\u63a7\u5236\u5c0f\u6570\u70b9\u540e\u7684\u4f4d\u6570\uff0c\u800c <code>Decimal<\/code> \u7c7b\u5219\u63d0\u4f9b\u4e86\u66f4\u9ad8\u7cbe\u5ea6\u7684\u6d6e\u70b9\u6570\u8fd0\u7b97\uff0c\u9002\u7528\u4e8e\u9700\u8981\u66f4\u7cbe\u786e\u63a7\u5236\u7684\u573a\u666f\u3002<strong>\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u4f7f\u7528 <code>round()<\/code> \u51fd\u6570\u7684\u65b9\u6cd5\u3002<\/strong><\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528 <code>round()<\/code> \u51fd\u6570<\/h3>\n<\/p>\n<p><p><code>round()<\/code> \u51fd\u6570\u662f Python \u5185\u7f6e\u7684\u4e00\u4e2a\u51fd\u6570\uff0c\u7528\u4e8e\u5c06\u4e00\u4e2a\u6570\u5b57\u56db\u820d\u4e94\u5165\u5230\u6307\u5b9a\u7684\u5c0f\u6570\u4f4d\u6570\u3002\u5b83\u7684\u4f7f\u7528\u975e\u5e38\u7b80\u5355\uff0c\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">round(number, ndigits)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ul>\n<li><code>number<\/code> \u662f\u4f60\u8981\u8fdb\u884c\u56db\u820d\u4e94\u5165\u7684\u6570\u5b57\u3002<\/li>\n<li><code>ndigits<\/code> \u662f\u4f60\u60f3\u8981\u4fdd\u7559\u7684\u5c0f\u6570\u4f4d\u6570\u3002<\/li>\n<\/ul>\n<p><p>\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">&gt;&gt;&gt; round(3.14159, 2)<\/p>\n<p>3.14<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4f8b\u5b50\u5c06 <code>3.14159<\/code> \u56db\u820d\u4e94\u5165\u5230\u5c0f\u6570\u70b9\u540e\u4e24\u4f4d\uff0c\u7ed3\u679c\u662f <code>3.14<\/code>\u3002<\/p>\n<\/p>\n<p><h4>\u7ec6\u8282\u8bf4\u660e<\/h4>\n<\/p>\n<p><p><code>round()<\/code> \u51fd\u6570\u7684\u5b9e\u73b0\u4f9d\u8d56\u4e8e\u6d6e\u70b9\u6570\u7684\u8868\u793a\uff0c\u56e0\u6b64\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u53ef\u80fd\u4f1a\u51fa\u73b0\u7cbe\u5ea6\u95ee\u9898\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">&gt;&gt;&gt; round(2.675, 2)<\/p>\n<p>2.67<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u91cc\u7684\u7ed3\u679c\u662f <code>2.67<\/code> \u800c\u4e0d\u662f\u9884\u671f\u7684 <code>2.68<\/code>\uff0c\u8fd9\u662f\u56e0\u4e3a\u6d6e\u70b9\u6570\u7684\u8868\u793a\u65b9\u5f0f\u5bfc\u81f4\u4e86\u8fd9\u79cd\u60c5\u51b5\u3002\u5bf9\u4e8e\u9700\u8981\u9ad8\u7cbe\u5ea6\u7684\u573a\u666f\uff0c\u53ef\u4ee5\u8003\u8651\u4f7f\u7528 <code>Decimal<\/code> \u7c7b\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528\u683c\u5f0f\u5316\u5b57\u7b26\u4e32<\/h3>\n<\/p>\n<p><p>\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\u63d0\u4f9b\u4e86\u53e6\u4e00\u79cd\u63a7\u5236\u5c0f\u6570\u70b9\u540e\u4f4d\u6570\u7684\u65b9\u6cd5\u3002Python \u7684\u5b57\u7b26\u4e32\u683c\u5f0f\u5316\u529f\u80fd\u975e\u5e38\u5f3a\u5927\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u79cd\u65b9\u5f0f\u5b9e\u73b0\u3002<\/p>\n<\/p>\n<p><h4>\u4f7f\u7528 f-string<\/h4>\n<\/p>\n<p><p>Python 3.6 \u4ee5\u540e\u5f15\u5165\u4e86 f-string\uff0c\u662f\u4e00\u79cd\u975e\u5e38\u7b80\u6d01\u548c\u76f4\u89c2\u7684\u683c\u5f0f\u5316\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">&gt;&gt;&gt; number = 3.14159<\/p>\n<p>&gt;&gt;&gt; formatted_number = f&quot;{number:.2f}&quot;<\/p>\n<p>&gt;&gt;&gt; formatted_number<\/p>\n<p>&#39;3.14&#39;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u91cc\u7684 <code>.2f<\/code> \u8868\u793a\u4fdd\u7559\u4e24\u4f4d\u5c0f\u6570\uff0c<code>f<\/code> \u8868\u793a\u6d6e\u70b9\u6570\u3002<\/p>\n<\/p>\n<p><h4>\u4f7f\u7528 <code>format()<\/code> \u65b9\u6cd5<\/h4>\n<\/p>\n<p><p>\u53e6\u4e00\u79cd\u5e38\u7528\u7684\u683c\u5f0f\u5316\u65b9\u6cd5\u662f\u4f7f\u7528 <code>format()<\/code> \u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">&gt;&gt;&gt; number = 3.14159<\/p>\n<p>&gt;&gt;&gt; formatted_number = &quot;{:.2f}&quot;.format(number)<\/p>\n<p>&gt;&gt;&gt; formatted_number<\/p>\n<p>&#39;3.14&#39;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e24\u79cd\u65b9\u6cd5\u7684\u6548\u679c\u662f\u4e00\u6837\u7684\uff0c\u9009\u62e9\u54ea\u79cd\u65b9\u5f0f\u53d6\u51b3\u4e8e\u4e2a\u4eba\u559c\u597d\u548c\u4ee3\u7801\u98ce\u683c\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528 <code>Decimal<\/code> \u7c7b<\/h3>\n<\/p>\n<p><p>\u5bf9\u4e8e\u9700\u8981\u9ad8\u7cbe\u5ea6\u7684\u573a\u666f\uff0c\u53ef\u4ee5\u4f7f\u7528 <code>Decimal<\/code> \u7c7b\u3002<code>Decimal<\/code> \u7c7b\u662f Python \u7684 <code>decimal<\/code> \u6a21\u5757\u4e2d\u7684\u4e00\u4e2a\u7c7b\uff0c\u5b83\u63d0\u4f9b\u4e86\u6bd4\u5185\u7f6e\u7684\u6d6e\u70b9\u6570\u66f4\u9ad8\u7684\u7cbe\u5ea6\u548c\u66f4\u597d\u7684\u63a7\u5236\u3002<\/p>\n<\/p>\n<p><h4>\u5f15\u5165 <code>Decimal<\/code> \u7c7b<\/h4>\n<\/p>\n<p><p>\u9996\u5148\u9700\u8981\u5f15\u5165 <code>decimal<\/code> \u6a21\u5757\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from decimal import Decimal, getcontext<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>\u8bbe\u7f6e\u7cbe\u5ea6<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u901a\u8fc7 <code>getcontext().prec<\/code> \u8bbe\u7f6e\u5168\u5c40\u7cbe\u5ea6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">getcontext().prec = 6<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>\u56db\u820d\u4e94\u5165<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528 <code>quantize()<\/code> \u65b9\u6cd5\u53ef\u4ee5\u5b9e\u73b0\u56db\u820d\u4e94\u5165\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">&gt;&gt;&gt; number = Decimal(&#39;3.14159&#39;)<\/p>\n<p>&gt;&gt;&gt; rounded_number = number.quantize(Decimal(&#39;0.00&#39;))<\/p>\n<p>&gt;&gt;&gt; rounded_number<\/p>\n<p>Decimal(&#39;3.14&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><code>Decimal(&#39;0.00&#39;)<\/code> \u8868\u793a\u4fdd\u7559\u4e24\u4f4d\u5c0f\u6570\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u5904\u7406\u91d1\u878d\u8ba1\u7b97\u548c\u9ad8\u7cbe\u5ea6\u9700\u6c42<\/h3>\n<\/p>\n<p><p>\u5728\u91d1\u878d\u8ba1\u7b97\u548c\u79d1\u5b66\u8ba1\u7b97\u4e2d\uff0c\u7cbe\u5ea6\u5c24\u4e3a\u91cd\u8981\u3002\u5728\u8fd9\u4e9b\u573a\u666f\u4e2d\uff0c\u4f7f\u7528 <code>Decimal<\/code> \u7c7b\u4f1a\u6bd4\u4f7f\u7528\u6d6e\u70b9\u6570\u66f4\u53ef\u9760\u3002<\/p>\n<\/p>\n<p><h4>\u4f8b\u5b50<\/h4>\n<\/p>\n<p><p>\u5047\u8bbe\u4f60\u5728\u8fdb\u884c\u5927\u91cf\u7684\u91d1\u878d\u4ea4\u6613\u8ba1\u7b97\uff0c\u9700\u8981\u786e\u4fdd\u6bcf\u6b21\u8ba1\u7b97\u90fd\u7cbe\u786e\u5230\u5c0f\u6570\u70b9\u540e\u4e24\u4f4d\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from decimal import Decimal<\/p>\n<h2><strong>\u4e24\u4e2a\u4ea4\u6613\u91d1\u989d<\/strong><\/h2>\n<p>amount1 = Decimal(&#39;100.1234&#39;)<\/p>\n<p>amount2 = Decimal(&#39;200.5678&#39;)<\/p>\n<h2><strong>\u8ba1\u7b97\u603b\u91d1\u989d\u5e76\u4fdd\u7559\u4e24\u4f4d\u5c0f\u6570<\/strong><\/h2>\n<p>total_amount = amount1 + amount2<\/p>\n<p>total_amount = total_amount.quantize(Decimal(&#39;0.00&#39;))<\/p>\n<p>print(f&quot;\u603b\u91d1\u989d\u662f: {total_amount}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4f8b\u5b50\u786e\u4fdd\u4e86\u6bcf\u6b21\u8ba1\u7b97\u90fd\u7cbe\u786e\u5230\u5c0f\u6570\u70b9\u540e\u4e24\u4f4d\uff0c\u907f\u514d\u4e86\u6d6e\u70b9\u6570\u53ef\u80fd\u5e26\u6765\u7684\u8bef\u5dee\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u5728\u6570\u636e\u5206\u6790\u4e2d\u7684\u5e94\u7528<\/h3>\n<\/p>\n<p><p>\u5728\u6570\u636e\u5206\u6790\u4e2d\uff0c\u7ecf\u5e38\u9700\u8981\u5bf9\u5927\u91cf\u6570\u636e\u8fdb\u884c\u5904\u7406\u548c\u8ba1\u7b97\uff0c\u7cbe\u5ea6\u540c\u6837\u91cd\u8981\u3002\u65e0\u8bba\u662f\u5904\u7406\u8d22\u52a1\u6570\u636e\u8fd8\u662f\u79d1\u5b66\u6570\u636e\uff0c\u786e\u4fdd\u5c0f\u6570\u70b9\u540e\u4e24\u4f4d\u7684\u7cbe\u5ea6\u90fd\u662f\u5e38\u89c1\u9700\u6c42\u3002<\/p>\n<\/p>\n<p><h4>\u4f8b\u5b50<\/h4>\n<\/p>\n<p><p>\u5047\u8bbe\u4f60\u5728\u5904\u7406\u4e00\u7ec4\u6570\u636e\uff0c\u9700\u8981\u8ba1\u7b97\u6bcf\u4e2a\u6570\u636e\u70b9\u7684\u5e73\u5747\u503c\uff0c\u5e76\u786e\u4fdd\u7ed3\u679c\u4fdd\u7559\u4e24\u4f4d\u5c0f\u6570\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">data = [Decimal(&#39;1.234&#39;), Decimal(&#39;5.678&#39;), Decimal(&#39;3.456&#39;)]<\/p>\n<h2><strong>\u8ba1\u7b97\u5e73\u5747\u503c<\/strong><\/h2>\n<p>average = sum(data) \/ len(data)<\/p>\n<p>average = average.quantize(Decimal(&#39;0.00&#39;))<\/p>\n<p>print(f&quot;\u5e73\u5747\u503c\u662f: {average}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u4f8b\u5b50\u540c\u6837\u786e\u4fdd\u4e86\u7ed3\u679c\u7684\u7cbe\u5ea6\uff0c\u907f\u514d\u4e86\u6d6e\u70b9\u6570\u53ef\u80fd\u5e26\u6765\u7684\u8bef\u5dee\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u603b\u7ed3\u4e0e\u6700\u4f73\u5b9e\u8df5<\/h3>\n<\/p>\n<p><p>\u5728 Python \u4e2d\u8ba1\u7b97\u5c0f\u6570\u70b9\u540e\u4e24\u4f4d\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u9009\u62e9\u54ea\u79cd\u65b9\u6cd5\u53d6\u51b3\u4e8e\u5177\u4f53\u7684\u9700\u6c42\u3002\u5bf9\u4e8e\u4e00\u822c\u7684\u56db\u820d\u4e94\u5165\uff0c\u4f7f\u7528 <code>round()<\/code> \u51fd\u6570\u6216\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\u5df2\u7ecf\u8db3\u591f\u3002\u5982\u679c\u9700\u8981\u66f4\u9ad8\u7684\u7cbe\u5ea6\u548c\u63a7\u5236\uff0c\u5efa\u8bae\u4f7f\u7528 <code>Decimal<\/code> \u7c7b\u3002<\/p>\n<\/p>\n<p><p><strong>\u6700\u4f73\u5b9e\u8df5\uff1a<\/strong><\/p>\n<\/p>\n<ol>\n<li><strong>\u7b80\u5355\u573a\u666f<\/strong>\uff1a\u4f7f\u7528 <code>round()<\/code> \u51fd\u6570\u6216\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\u3002<\/li>\n<li><strong>\u9ad8\u7cbe\u5ea6\u9700\u6c42<\/strong>\uff1a\u4f7f\u7528 <code>Decimal<\/code> \u7c7b\u3002<\/li>\n<li><strong>\u91d1\u878d\u8ba1\u7b97<\/strong>\uff1a\u59cb\u7ec8\u4f7f\u7528 <code>Decimal<\/code> \u7c7b\uff0c\u786e\u4fdd\u6bcf\u6b21\u8ba1\u7b97\u7684\u7cbe\u5ea6\u3002<\/li>\n<\/ol>\n<p><p>\u65e0\u8bba\u9009\u62e9\u54ea\u79cd\u65b9\u6cd5\uff0c\u90fd\u5e94\u5f53\u6839\u636e\u5177\u4f53\u9700\u6c42\u548c\u573a\u666f\u8fdb\u884c\u6743\u8861\uff0c\u786e\u4fdd\u7ed3\u679c\u7684\u51c6\u786e\u6027\u548c\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5728Python\u4e2d\uff0c\u5982\u4f55\u786e\u4fdd\u6d6e\u70b9\u6570\u4ec5\u4fdd\u7559\u4e24\u4f4d\u5c0f\u6570\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u5185\u7f6e\u7684<code>round()<\/code>\u51fd\u6570\u6765\u4fdd\u7559\u6d6e\u70b9\u6570\u7684\u5c0f\u6570\u4f4d\u6570\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u6709\u4e00\u4e2a\u6d6e\u70b9\u6570<code>num<\/code>\uff0c\u53ef\u4ee5\u901a\u8fc7<code>rounded_num = round(num, 2)<\/code>\u6765\u5c06\u5176\u56db\u820d\u4e94\u5165\u5230\u5c0f\u6570\u70b9\u540e\u4e24\u4f4d\u3002\u6b64\u5916\uff0c\u4f7f\u7528\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\uff08\u4f8b\u5982<code>f&quot;{num:.2f}&quot;<\/code>\uff09\u4e5f\u53ef\u4ee5\u8fbe\u5230\u76f8\u540c\u7684\u6548\u679c\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5728\u8f93\u51fa\u65f6\u5c24\u5176\u65b9\u4fbf\u3002<\/p>\n<p><strong>\u5728Python\u4e2d\uff0c\u5982\u4f55\u5c06\u6570\u503c\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u5e76\u9650\u5236\u4e3a\u4e24\u4f4d\u5c0f\u6570\uff1f<\/strong><br \/>\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u4e32\u683c\u5f0f\u5316\u65b9\u6cd5\u6765\u5c06\u6570\u503c\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u5e76\u9650\u5236\u5c0f\u6570\u4f4d\u6570\u3002\u4f7f\u7528<code>format()<\/code>\u51fd\u6570\u6216f-string\u53ef\u4ee5\u5b9e\u73b0\u3002\u4f8b\u5982\uff0c<code>&quot;{:.2f}&quot;.format(num)<\/code>\u6216<code>f&quot;{num:.2f}&quot;<\/code>\u90fd\u4f1a\u5c06<code>num<\/code>\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\uff0c\u540c\u65f6\u786e\u4fdd\u5c0f\u6570\u70b9\u540e\u53ea\u6709\u4e24\u4f4d\u3002<\/p>\n<p><strong>\u5982\u4f55\u5904\u7406\u6d6e\u70b9\u6570\u8fd0\u7b97\u65f6\u53ef\u80fd\u51fa\u73b0\u7684\u7cbe\u5ea6\u95ee\u9898\uff1f<\/strong><br \/>\u5728\u8fdb\u884c\u6d6e\u70b9\u6570\u8fd0\u7b97\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u7cbe\u5ea6\u95ee\u9898\u3002\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528<code>decimal<\/code>\u6a21\u5757\u6765\u907f\u514d\u8fd9\u79cd\u60c5\u51b5\u3002<code>decimal.Decimal<\/code>\u7c7b\u5141\u8bb8\u66f4\u7cbe\u786e\u7684\u6570\u503c\u8868\u793a\uff0c\u4f7f\u7528<code>Decimal(&#39;\u6570\u503c&#39;).quantize(Decimal(&#39;0.00&#39;))<\/code>\u53ef\u4ee5\u786e\u4fdd\u7ed3\u679c\u4fdd\u6301\u4e24\u4f4d\u5c0f\u6570\uff0c\u8fd9\u6837\u53ef\u4ee5\u907f\u514d\u5e38\u89c4\u6d6e\u70b9\u6570\u8fd0\u7b97\u5e26\u6765\u7684\u8bef\u5dee\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u5982\u4f55\u8ba1\u7b97\u5c0f\u6570\u70b9\u540e\u4e24\u4f4d\uff0c\u4f7f\u7528\u5185\u7f6e\u51fd\u6570round()\u3001\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\u3001Decimal\u7c7b Python \u63d0 [&hellip;]","protected":false},"author":3,"featured_media":1132335,"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\/1132327"}],"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=1132327"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1132327\/revisions"}],"predecessor-version":[{"id":1132336,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1132327\/revisions\/1132336"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1132335"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1132327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1132327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1132327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}