python2 保留几位小数

自带函数 round(0.115,2)----> 0.11,与预期不符

自定义:

def round2(num,scale):

  return round(num*10**scale)*10**(-scale)

  

原文地址:https://www.cnblogs.com/geosnoob/p/14299938.html