如何修复此索引错误?

How can I fix this index error?

Well this is the code I have written so far

import csv
file = open("gardeningJobs.txt", "r")
read= csv.reader(file)
ls=list(read)
file.close()
print(ls)


total=0
status = " A"
for line in ls:
    if (int(line[3] - int(line[4]) = 0):
        total += int(line[4])
        print(total)

The error occures in this line of code if (int(line[3] - int(line[4]) = 0):

1234, 27/02/2016, A56, 125, Q, 0 1235, 27/02/2016, A26, 250, A, 125 1236, 27/02/2016, A36, 300, N, 0 1237, 27/02/2016, A55, 170, Q, 0 1238, 28/02/2016, A59, 90, A, 90 1240, 28/02/2016, A60, 260, A, 120

This is the 2D array that goes with it in a file

如有任何帮助,我们将不胜感激

您的代码应该是这样的:

if int(line[3]) - int(line[4]) == 0:

== 而不是 =int(line[3]).