1.下载xlwt的Python库 (This is a library for developers to use to generate spreadsheet files compatible with Microsoft Excel versions 95 to 2003.) 下载页面:xlwt 1.2.0 注:由于公司网络无法直接进行下载,需要这样办法. 2.安装 xlwt库 在Windows的命令行下,执行:python setup.py install
def write_excels(self, document): outwb = openpyxl.Workbook() outws = outwb.create_sheet(index=0) for y, docs in enumerate(document): key = [doc for doc in docs] for x, ky in enumerate(key): outws.cell(y + 1, x + 1).value = docs[ky] outwb.save("xxx.x