I\'m trying to align the output of the list like shown:
But it keeps coming out like this:
My code for all of this is:
subject_
You can't do this using plain Python formatting because the amount of padding depends on both strings. Try defining a function such as:
def format_justified(left, right, total):
padding = total - len(left)
return "{{0}}{{1:>{}}}".format(padding).format(left, right)
then simply use:
print(format_justified("Total cp:", total, 25))
where 25 is the total line width you want.