ich habe bisher folgenden Code:
Code: Alles auswählen
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
from BeautifulSoup import BeautifulSoup
url = urllib2.urlopen("http://www.domain.de")
html = url.read();
soup = BeautifulSoup(html)
# Alle Links raus suchen:
for anker in soup("a"):
links = dict(anker.attrs).get("href")
if links.count("King") > 0:
print links
Sobald ich aber die Domain ändere in http://www.domain.de/index.php?site=100
so kommt folgende Fehlermeldung:
Woran liegts?Traceback (most recent call last):
File "test.py", line 16, in <module>
if links.count("King") > 0:
AttributeError: 'NoneType' object has no attribute 'count'
Gruß
Nyrk