write array starting from specific column to new w

2019-07-02 11:58发布

I am trying to write an array (data = [][]) to a worksheet I will create using xlwt. My question is can I specify a column to start from? I am planning to use a for loop to iterate through the array retrieving the values row by row starting a new line with each row ex: first row starts at C1, next row starts at C2 etc... I have read the documentation and examples but cannot find a clear way to do this. Any help would be greatly appreciated!

标签: python xlwt
1条回答
来,给爷笑一个
2楼-- · 2019-07-02 12:36

Something like:

wb = xlwt.Workbook()
ws = wb.add_sheet('Sheet1')
for r, row in enumerate(data):
    for c, col in enumerate(row):
        ws.write(r, 2 + c, label=col)
查看更多
登录 后发表回答