Attributeerror: 'list' Object Has No Attribute 'timeout' - Trying To Process Multiple Urls With Beautifulsoup
I am trying to grab and parse multiple URLs using urllib and BeautifulSoup, but I get the following error: AttributeError: 'list' object has no attribute 'timeout' From what I unde
Solution 1:
Your error clearly said 'list' object has no attribute 'timeout'
It's because urlopen doesn't take in a list. you should nest it in a loop like this:
my_texts = []
for each in addresses
html = urllib.request.urlopen(addresses).read()
print(text_from_html(html)) # or assign to variable like:
my_texts.append(text_from_html(html))
I would suggest you to use a better module for http than urllib
, use requests
instead (import requests
)
Post a Comment for "Attributeerror: 'list' Object Has No Attribute 'timeout' - Trying To Process Multiple Urls With Beautifulsoup"