Reputation:
I try to get the text from an html looking like this:
</td><td align='center'> </td><td align='right'>0.1200</td><td align='left'><img
I'm interested in getting the number "0.1200".
My code is this:
`url = "http://...."
source_code = requests.get(url)
plain_text = source_code.text
soup = BeautifulSoup(plain_text, "lxml")
for link in soup.findAll('td', {'align': 'right'}):
for row in link.find_next_sibling("td"):
print(row)
I get an error message "TypeError: 'NoneType' object is not iterable". Any sugestions on fixing the problem?
Upvotes: 1
Views: 5183
Reputation: 1357
Can you try this out please? (It is hard to help you out if you don't give us the URL)
Code:
soup = BeautifulSoup(plain_text, "lxml")
for link in soup.findAll('td', {'align': 'right'}):
print(link.text)
Upvotes: 1