formatting float number, use the f specifier and supply the precision as a . (dot) followed by the number of decimals : Float format : Data Type PYTHON TUTORIALS


PYTHON TUTORIALS » Data Type » Float format »

 

formatting float number, use the f specifier and supply the precision as a . (dot) followed by the number of decimals


format = "Pi with three decimals: %.3f" 
from math import pi 
print format % pi



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Data Type
» Float format