Aug-15-2017, 07:07 AM
hi,
The code is working now.
I did the following changes
The code is working now.
I did the following changes
with open('Basic Materials.htm') as fp: soup=BeautifulSoup(fp,'lxml') table=soup.find('div',{'class':'sfe-break-bottom'}) for row in table.find_all('tr'): for cells in row.find_all('td'): for link in cells.find_all('a', limit=3): print(link.get_text()) # gets the name print(link.get('href')) # gets the linksnow its working.I removed the cells variable and used nested if statements