Right justify : rjust « String « Python Tutorial






chapters = {1:5, 2:46, 3:52, 4:87, 5:90}
hexStr = "3f8"


print "Hex String: " + hexStr.upper().rjust(8,'0')
print
for x in chapters:
    print "Chapter " + str(x) + str(chapters[x]).rjust(15,'.')








5.27.rjust
5.27.1.Right justify