Я получаю сообщение об ошибке:
Traceback (most recent call last):
File "clubranking.py", line 14, in <module>
ws_out = wb_out.add_sheet(sheet_name)
TypeError: unbound method add_sheet() must be called with Workbook instance as first argument (got unicode instance instead)
При попытке запустить скрипт Python:
#import the writer
import xlwt
#import the reader
import xlrd
#open document
wb_in = xlrd.open_workbook('sussex.xlsx')
#get first sheet's name from the document
sheet_name = wb_in.sheet_names()[0]
#select sheet by name
ws_in = wb_in.sheet_by_name(sheet_name)
#init xlwt object, to be able to write data
wb_out = xlwt.Workbook
#initialise first sheet from the previously opened document, for
writing
ws_out = wb_out.add_sheet(sheet_name)
#print the values in the second column of the first sheet
print first_sheet.col_values(1)
book = xlwt.Workbook('sussex.xlsx')
#in cell 0,0 (first cell of the first row) write "NIF"
first_sheet.write(0, 6, "NIF")
#in cell 0,0 (first cell of the first row) write "Points scored"
first_sheet.write(0, 6, "Points scored")
Я не уверен, в чем проблема, поскольку я новичокв этой области, но любая помощь будет принята с благодарностью.То, что я пытаюсь достичь, обрисовано в общих чертах, это еще один вопрос, который я написал: Как заставить скрипт Python записать на существующий лист