I have a series of HTML files that are parsed into a single text file using Beautiful Soup. The HTML files are formatted such that their output is always three lines within
Perhaps I didn't understand you correctly, but you can do:
file = open("extracted.txt")
# if you don't want to do .strip() again, just create a list of the stripped
# lines first.
lines = [line.strip() for line in file if line.strip()]
for i, line in enumerate(lines):
csv.SetCell(i % 3, line)