I have two files having diff data. I want to write it to excel using python . I have given defined 4 columns Headlines.
Below is the snippet. I want both to club so that I do not have to define row and col two times . ABC.txt and LMN.txt both have data to write in xlsx.
row=1
col=0
with open('ABC.txt','r') as f:
for K in f:
worksheet.write(row,col,K)
row+=1
row=1
col=0
with open('LMN.txt','r') as f:
for X in f:
worksheet.write_url(row , col+1, X)
row += 1
workbook.close()