>>> "{0:0.1f}".format(45.34531)
'45.3'
# 2.6 python and newer and python 3.x
# Put desired number of decimal by changing the number inside {:.2f} bellow;
print(' {:.2f}'.format(71.428571))
71.43
# 2.6 python and older
# Put desired number of decimal by changing the number inside '%.2f' bellow;
print('%.2f'%(71.428571))
71.43
number = 3.333333
result = format(number, ".2g")
print("Formatted decimal number result is =>", result)
"Formatted decimal number result is => 3.33"