p = 1.234 p = round(p,2) print(p) # 1.23 #round(你要操作的数,保留几位) 转载于:https://www.cnblogs.com/liangying666/p/9161711.html