who_care

导航

 

2017年10月25日

摘要: a和b是整数,计算a/b的百分比 a=3 b=7 a=float(a) b=float(b) 保留百分比后2位小数 print "%.2f%%" % (a/b*100) '42.86%' 保留百分比后1位小数 print "%.1f%%" % (a/b*100) '42.9%' 保留百分比 prin 阅读全文
posted @ 2017-10-25 08:42 who_care 阅读(4060) 评论(0) 推荐(0) 编辑