def __init__(self): self.companys= set() self.jobs=set() self.filelist=[] self.reall=[] def GetFileList(self,dir): for s in os.listdir(dir): self.filelist.append(s) def FileHandle(self): while(self.filelist): filename=self.filelist.pop() soup=BeautifulSoup(open('resources/'+filename),'html.parser') link_jobs=soup.find_all('span','title') link_companys=soup.find_all('span','org summary') if link_jobs: for i in range(len(link_jobs)): item=[link_jobs[i].string,link_companys[i].string,filename] self.reall.extend(item) 从item=[link_jobs[i].string,link_companys[i].string,filename]开始提示 list index out of range,但是感觉i是在范围内的啊?
仓颉小米
相关分类