Verwenden mehrerer NOT IN-Anweisungen mit Python
Ich muss URLs mit drei spezifischen Teilzeichenfolgen aus einer Schleife entfernen. Der folgende Code hat funktioniert, aber ich bin mir sicher, dass es eine elegantere Möglichkeit gibt:
for node in soup.findAll('loc'):
url = node.text.encode("utf-8")
if "/store/" not in url and "/cell-phones/" not in url and "/accessories/" not in url:
objlist.loc.append(url)
else:
continue
Vielen Dank