=== Python print format: Here are the testing code {{{ python> print '%-10s --- %10d' %('aimin', 12) aimin --- 12 python> print '%.10s --- %.10d' %('aimin', 12) aimin --- 0000000012 python> print '%-10s --- %-10d' %('aimin', 12) aimin --- 12 python> print '%e | %f | %g | %.3f' % (1.23456789,1.23456789,1.23456789,1.23456789) 1.234568e+00 | 1.234568 | 1.23457 | 1.235 python> print "%o %x %X" % (64, 64, 255) 100 40 FF }}} === Python list usage: You want to get the mean of the best 8 scores in [ '36.7', '26.0', '40.0', '33.6', '34.0', '36.4', '36.5', '32.7', '36.7','40.0', '40.0'] Code: {{{ a= [ '36.7', '26.0', '40.0', '33.6', '34.0', '36.4', '36.5', '32.7', '36.7','40.0', '40.0'] a=map(float, a) a.sort() mean = sum( a[-8:] )/8.0 }}} Ref: [[http://www.java2s.com/Code/Python/Development/Useprintascprintfs.htm|Use python print as c printfs]]