[英]xlwt can't write to xls file?
遵循寫xls文件的指南,使用的示例如下:
wb = xlwt.Workbook()
newsheet=wb.add_sheet('sheet1')
newsheet.write('0','0','testing')
wb.save(testing.xls)
但是我收到一條錯誤消息:
ValueError:行索引為“ 0”,。xls格式不允許
這可能是一個非常愚蠢的問題(但根據指南,這顯示為“有效”,有人知道是什么原因造成的嗎?
write()
方法的前兩個參數必須是行號和列號,而不是字符串:
newsheet.write(0, 0, 'testing')
僅供參考,這是write()
方法docstring :
def write(self, r, c, label="", style=Style.default_style):
"""
This method is used to write a cell to a :class:`Worksheet`.
:param r:
The zero-relative number of the row in the worksheet to which
the cell should be written.
:param c:
The zero-relative number of the column in the worksheet to which
the cell should be written.
...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.