I have a script which has a column field as:
States = ['Massachusetts', 'Pennsylvania','Utah','Ohio','California']
I do a couple of file and data processing and print the field as:
print '-'*200
print 'Name\tPopulation\tAverage Income\Crime Rate'
print '-'*200
for s in States:
print '%s\t%s/%s\t%s\t%s' % (s, p_f, p_m, av, cr)
The output looks like:
-------------------------------------------------------------------------
Name Population Avergae Income Crime Rate
-------------------------------------------------------------------------
Massachusetts 100000/100000 5000 50
Pennsylvania 100000/100000 5000 50
Utah 100000/100000 5000 50
Ohio 100000/100000 5000 50
California 100000/100000 5000 50
However, I would like data to be aligned right side
-------------------------------------------------------------------------
Name Population Avergae Income Crime Rate
-------------------------------------------------------------------------
Massachusetts 100000/100000 5000 50
Pennsylvania 100000/100000 5000 50
Utah 100000/100000 5000 50
Ohio 100000/100000 5000 50
California 100000/100000 5000 50
I am using python 2.7