1、浮点数相加问题a= 0.3b= 0.2+0.1print(a,b)输出:0.3 0.30000000000000004 解决办法:使用decimal库from decimal import *a = Decimal('4.2')b = Decimal('2.1')c = a * b