Python spacing and aligning strings
Try %*s
and %-*s
and prefix each string with the column width:
>>> print "Location: %-*s Revision: %s" % (20,"10-10-10-10","1")
Location: 10-10-10-10 Revision: 1
>>> print "District: %-*s Date: %s" % (20,"Tower","May 16, 2012")
District: Tower Date: May 16, 2012
You should be able to use the format method:
"Location: {0:20} Revision {1}".format(Location, Revision)
You will have to figure out the format length for each line depending on the length of the label. The User
line will need a wider format width than the Location
or District
lines.