There is data:
[(1,),(2,),(3,)],[('a',),('b',),('c',)], [('e',),('f',),('g',)] respectively represent the values of three different columns.
The requirement is: write table records horizontally:
My program is as follows. It can only implement sequence insertion. I don’t know how to modify the insertion order. Please give me some guidance.
import xlwt
wb = xlwt.Workbook(encoding='utf-8')
ws = wb.add_sheet('Sheet1', cell_overwrite_ok=True)
data = (
[(1,),(2,),(3,)],
[('a',),('b',),('c',)],
[('e',),('f',),('g',)],
)
for index, value in enumerate(data):
for r_num, r_value in enumerate(value):
ws.write(r_num, index,r_value[0])
wb.save('test.xls')
ws.write(index, r_num,r_value)