Skip to content Skip to sidebar Skip to footer

Error "list Indices Must Be Integers Or Slices, Not Str" While Looping

I'm trying to parse only the replies to my emails, which are stored in a CSV file. I am making use of this library which seems to be geared at doing that. My CSV columns look like

Solution 1:

Your loop should be like this:

with open('D:/clean.csv', 'w') as outf:
    writer = csv.writer(outf)
    # need to skip the title
    title = reader.__next__()
    for row in reader:
        EmailReplyParser.parse_reply(row[0].split()[-1])
    writer.writerows(reader)

Post a Comment for "Error "list Indices Must Be Integers Or Slices, Not Str" While Looping"