不明白这个错误意味着什么:TypeError:'int'对象不可调用

我是新来的python和努力了解这个错误意味着什么:TypeError:'int'对象不可调用

这里是完整的代码:

import openpyxl, pprint,os os.chdir('C:\Users\Shend_000\Documents\Py CWD') wb=openpyxl.load_workbook('censuspopdata.xlsx') sheet=wb.get_sheet_by_name('Population by Census Tract') countyData={} for row in range(2,sheet.max_row()): state=sheet['B'+str(row)].value county=sheet['C'+str(row)].value pop=sheet['D'+str(row)].value countyData.setdefault(state,{}) countyData[state].setdefault(county,{'tracts':0, 'pop':0}) countyData[state][county]['tracts']+=1 countyData[state][county]['pop']+=int(pop) resultFile=open('census2010.py','w') resultFile.write('allData= '+pprint.pformat(countyData)) resultFile.close() print 'Done.' 

只要改变这一点:

 for row in range(2,sheet.max_row): 

sheet.max_row返回int ,你不能调用int