I've written my very first webscraper, and I am now attempting to write the data to excel files.
This is the relevant part of my program:
with xlsxwriter.Workbook('test 2.xlsx') as workbook:
worksheet = workbook.add_worksheet("Doctissimo's diabetes sub-forum")
row = 0
col = 0
for time, handle, post, URL in list(zip(time_stamps, handles, post_contents, URLs)):
print(time, handle, URL)
worksheet.write(row, col, time)
worksheet.write(row, col+1, handle)
worksheet.write(row, col+2, post)
worksheet.write(row, col+3, URL)
row = +1
One way to systematically find some bug is to use the print statement, row are supposed to be increased by 1 every loop, if you put a print statement after row, you should be able to see what is wrong.
row = +1 print "row = %d" % row
I did not see = +1 at the first time. But the value of row never changes.