xlwt不能写入xls文件?
一直遵循一个指南写入xls文件,并使用exmaple如下:
wb = xlwt.Workbook() newsheet=wb.add_sheet('sheet1') newsheet.write('0','0','testing') wb.save(testing.xls)
但是我得到一个错误说:
ValueError:行索引为“0”,不允许使用.xls格式
这可能是一个非常愚蠢的问题(但是由于指南显示这是“有效的”,有人知道这是什么原因?
write()
方法的前两个参数必须是行号和列号,而不是string:
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. ...