My Code:
infile = open("table1.txt", "r")
a_list = infile.read().split("\n")
infile.close()
for pass_num in range(len(a_list)-1, 0, -1):
for i in range(0, pass_num):
if int(a_list[i].split(",")[1].strip()) > int(a_list[i+1].split(",")[1].strip()):
a_list[i], a_list[i+1] = a_list[i+1], a_list[i]
if (int(a_list[i].split(",")[1].strip()) == int(a_list[i+1].split(",")[1].strip())) and ((int(a_list[i].split(",")[2]) - int(a_list[i].split(",")[3].strip())) > (int(a_list[i+1].split(",")[2].strip()) - int(a_list[i+1].split(",")[3].strip()))):
a_list[i], a_list[i+1] = a_list[i+1], a_list[i]
if (int(a_list[i].split(",")[1].strip()) == int(a_list[i+1].split(",")[1].strip())) and ((int(a_list[i].split(",")[2]) - int(a_list[i].split(",")[3].strip())) == (int(a_list[i+1].split(",")[2].strip()) - int(a_list[i+1].split(",")[3].strip()))):
if (int(a_list[i].split(",")[2])) > int(a_list[i+1].split(",")[2]):
a_list[i], a_list[i+1] = a_list[i+1], a_list[i]
a_list.reverse()
print(" Team" + " "*(30-len(" Team")) + "Points" + " "*2 + "Diff" + " "*4 + "Goals")
for i in range(len(a_list)):
team = a_list[i].split(",")[0]
points = a_list[i].split(",")[1]
goalfor = int(a_list[i].split(",")[2].strip())
goalagainst = int(a_list[i].split(",")[3].strip())
diff = goalfor - goalagainst
print(str(i+1).rjust(2) + ". " + '{0:27} {1:4} {2:4} {3:5} : {4:2}'.format(team, points, diff, goalfor, goalagainst))
#Area of interest above^
Current output:
Desired output:
Would anyone know how to edit the area of interest in the commented piece of code to produce the desired output with the 9's lined up underneath the 3 in 13? Ive been trying .rjust(1) but it wont seem to work.

