1>>> x = 13.949999999999999999
2>>> x
313.95
4>>> g = float("{:.2f}".format(x))
5>>> g
613.95
7>>> x == g
8True
9>>> h = round(x, 2)
10>>> h
1113.95
12>>> x == h
13True
1for x in numbers:
2 print "{:10.4f}".format(x)
3prints
4
5 23.2300
6 0.1233
7 1.0000
8 4.2230
9 9887.2000
1print('I love {} for "{}!"'.format('Geeks', 'Geeks'))
2print('{:0.3f} {:0.3f}'.format(y, z))
1from datetime import datetime
2
3'{:%Y-%m-%d %H:%M}'.format(datetime(2001, 2, 3, 4, 5))