1
다소 일반적인 질문입니다.다른 하위 클래스의 하위 클래스를 참조 할 수 있습니까?
함수가 포함 된 클래스를 만드는 경우 해당 클래스의 다른 함수를 참조 할 수 있습니까? 예를 들어
이 작업을 수행하는 self 변수를 통해
class pythonExcelFunctions():
def getSheetNumber(self, fileName, sheetName):
workbook = xlrd.open_workbook(fileName, on_demand=True)
for index, sheet in enumerate(workbook.sheet_names()):
if sheet == sheetName:
return index
def createSheet(self, fileName, sheetName):
rb = xlrd.open_workbook(fileName, formatting_info=True, on_demand=True)
wb = xl_copy(rb)
Sheet1 = wb.add_sheet(getSheetNumber(fileName, sheetName))
wb.save(fileName)
코드가 있습니다 ... 시도하지 않으시겠습니까? 작동하지 않으면 실패한 부분을 지적 할 수 있습니까? – mgilson
질문에있는 라인에 괄호가 없습니다. – Natecat
여기에 그 서브 클래스가 의미하는 바가 없다고 생각합니다. –