Collecting company data from accident reports
for i, j in enumerate (list):



You can't iterate through list because it is a type, so I am assuming that list is the name of a variable that you defined earlier on.  Don't do that.  When you use the name of something built-in for something else, you are overriding the variable that was previously defined.  If, for instance, you wanted to iterate through a list of tuples, but you actually wanted a list of lists, you could do for sub in map(list, tuples):, but with list redefined, you can't do that.  Besides that, it may confuse future readers of your code to be using list there when you can't iterate through a type.  Instead, use a name that not only says what type of object it is, but describes what is inside.

You have quite a bit of duplicate code in that if j == 'Last 10 accidents': block.  You should instead use a for loop iterating through different starting points.  That is, for start in (28, 50, 72): and use date = list[last + start], employee = date[list + start + 3], ...  You should be using a more descriptive name than list anyway, but I outlined that above.


with open("report.csv","a+") as report:
    report.write(str(name)+", "+str(date1)+", "+str(employee1)+", "+str(days_lost1)+", "+str(days_paid1))



Using a long string (no pun intended) of concatenations doesn't seem very good, does it?  Instead, use .join():

info = (name, date1, employee1, days_lost1)
report.write(", ".join(map(str, info)) + "\n")


That shortens the code and makes it a little easier to see what you are doing.


report.close()



The with statement will take care of closing the file so you don't need that line.

Your modified program would look like this:

name = company_location
for i, j in enumerate(reports):
    if j == 'Last 10 Accidents':
        last = i 
        for start in (28, 50, 72):
            try:
                date = reports[last + start]
                employee = reports[last + start + 3]
                days_lost = reports[last + start + 21] 
                days_paid = reports[last + start + 15] 
                info = (date, employee, days_lost, days_paid)
                with open("report.csv","a+") as report:
                    report.write(", ".join(map(str, info)) + "\n")
            except (ValueError, TypeError, IndexError):
                with open("report.csv","a+") as report:
                    report.write(str(name)+"\n")