def GetTextData(): TableRows = HTMLParser.GetDataFromTag("td", HTMLParser.initSoup("out.html")) i = 0 result = [] names = [] hours = [] for row in TableRows: #TODO за такой код я буду гореть в аду на 666 лет дольше try: tdlist = row.find_all("p") if tdlist is not []: if tdlist[0].contents[0].split(".")[0] == "СД": i = 1 continue if i == 1: #TODO Ловите наркомана! names.append(tdlist[0].contents[0]) i += 1 continue if i == 2: hours.append(tdlist[0].contents[0]) i = 0 except IndexError or AttributeError: print("ERROR") for item in names: result.append(EduStandartsParser.EduEntity(item, hours[names.index(item)])) return result
def GetLinksFromAllStandarts(): #EduStandartsParser.GetHTML() Links = [] TableRows = HTMLParser.GetDataFromTag("tr", HTMLParser.initSoup("output.html")) i = 14 while i < len(TableRows) - 1: if TableRows is not None: print(i) try: tmp = TableRows[i].find_all("th")[3] except IndexError: break if tmp is not None: Links.append(tmp.find("a", href=True)['href']) i += 1 return Links