為避免以上問題,用 round 處理浮點數的四捨五入時,可改用 Decimal 物件來定義精確浮點數值。 from decimal import Decimal d = Decimal('2.15') print( ...
確定! 回上一頁