python四舍五入保留2位小数

一、格式化输出    {:.2f}

print("{:.2f}".format(1/6))

   

二、使用   round函数    round(a,2)    

round(1/6,2)

    

原文地址:https://www.cnblogs.com/taiyangfeng/p/13060505.html