python format print example
In [1]:
print 'before: {:.2f} after'.format(1.5555)
In [2]:
print '{1},{0},{1},{2},{0}'.format('pos',777,True)
In [3]:
print '{name},{age}'.format(age=18,name='cutie')
In [4]:
has=['first', 2.00, 'third']
print '1st {0[0]} all: {0} last {0[2]} end'.format(has)
In [5]:
print 'start--- {:,} ---end'.format(9876543210)
In [6]:
print 'start:{:>8}'.format(123)
In [7]:
print 'start:{:0>8}'.format(123)
In [8]:
print 'start:{:A>8}'.format(123)
In [ ]:
In [ ]:
In [ ]: