python 整除,取余都是向下取整

 10//3=3,10%3=1, -10//3=-4.-10%3=2,  divmod(x,y)返回取整及余数 divmod(10,3) 返回3,1

print(0.1+0.1+0.1-0.3) 打印出来的不是0.0 需要 import Decimal ,print(Decimal (0.1)+Decimal (0.1)+Decimal (0.1)-Decimal (0.3)) 打印0.0

posted on 2020-06-10 19:37  liguang178  阅读(3513)  评论(0)    收藏  举报