[英]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.