BeautifulSoup HTML table parsing BeautifulSoup HTML table parsing python python

BeautifulSoup HTML table parsing


start = cols[1].find('a').string

or simpler

start = cols[1].a.string

or better

start = str(cols[1].find(text=True))

and

entry = [str(x) for x in cols.findAll(text=True)]


I was trying to reproduce your error, but the source html page was changed.

About the error, I had a similar problem, trying to reproduce the example is here

changing the proposed URL for a Wikipedia Table

I fixed it moving to BeautifulSoup4

from bs4 import BeautifulSoup

and changing the .string for .get_text()

start = cols[1].get_text()

I couldn't test with your example (as I said before, I couldn't reproduce the error) but I think it could be useful for people are looking for a solution to this problem.