python 2 decimal places

1 Code:

 

2 operating results:

 

3  wherein a string: print ( '.% 2f' % (x / y)) the best way

Guess you like

Origin www.cnblogs.com/finer/p/11105527.html