Code:Attribute: 'NoneType' Objekt hat kein Attribut 'unteren' in Python 3.4
import requests
from bs4 import BeautifulSoup
import operator
def start(url):
word_list =[]
source_code =requests.get(url).text
soup = BeautifulSoup(source_code)
for post_string in soup.find_all('a',{'class':'cb-skin-ads-link'}):
content = post_string.string
words = content.lower()
for each_word in words:
print(each_word)
word_list.append(each_word)
start('http://www.cricbuzz.com/live-cricket-scorecard/16445/gl-vs-rcb-qualifier-1-indian-premier-league-2016')
Fehler:
Traceback (most recent call last):
File "C:/Users/Shera/PycharmProjects/Begin/wordcount.py", line 15, in <module>
start('http://www.cricbuzz.com/live-cricket-scorecard/16445/gl-vs-rcb-qualifier-1-indian-premier-league-2016')
File "C:/Users/Shera/PycharmProjects/Begin/wordcount.py", line 10, in start
words = content.lower()
AttributeError: 'NoneType' object has no attribute 'lower'
Was ist Ihre Frage? –
'Inhalt' ist keine' Zeichenkette' ... – henrikstroem
Es gibt keinen Text in diesem Anker-Tag. Was versuchen Sie eigentlich zu parsen? –