I need to output 4 different floats to two decimal places.
This is what I have:
print '%.2f' % var1,'kg =','%.2f' % var2,'lb =','%.2f' % var3,'gal =','%.2f' % var4,'l'
Which is very unclean, and looks bad. Is there a way to make any float in that out put '%.2f'?
Note: Using Python 2.6.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…