import xlwt
book = xlwt.Workbook(encoding="utf-8")
sheet1 = book.add_sheet("Python Sheet 1")
sheet2 = book.add_sheet("Python Sheet 2")
sheet3 = book.add_sheet("Python Sheet 3")
sheet1.write(0, 0, "This is the First Cell of the First Sheet")
sheet2.write(0, 0, "This is the First Cell of the Second Sheet")
sheet3.write(0, 0, "This is the First Cell of the Third Sheet")
sheet2.write(1, 10, "This is written to the Second Sheet")
sheet3.write(0, 2, "This is part of a list of information in the Third Sheet")
sheet3.write(1, 2, "This is part of a list of information in the Third Sheet")
book.save("python_spreadsheet.xls")
有谁知道我为什么会收到这个错误?我真的只是从包的演示网站上复制了这段代码,但我得到了这个错误。
IOError: [Errno 13] Permission denied: 'python_spreadsheet.xls'
最佳答案
在 Windows 上,如果文件在 Excel 中打开,您会收到该错误。
在 Linux 上,如果您没有写入输出目录或文件的权限,您将收到该错误。
关于python - xlwt 错误消息 IOError : [Errno 13] Permission denied: 'python_spreadsheet.xls' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30781894/