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")
Кто-нибудь знает, почему я получаю эту ошибку? Я буквально просто скопировал этот код с демонстрационного сайта пакета, и я получил эту ошибку.Сообщение об ошибке xlwt IOError: [Errno 13] Разрешение отклонено: 'python_spreadsheet.xls'
IOError: [Errno 13] Разрешение отказано: «» python_spreadsheet.xls
У вас нет разрешения на запись файлов в этой папке. Попробуйте указать путь в 'book.save()', где у вас есть разрешения на запись. Или проверьте, открыт ли файл. – Vaulstein