ループから3つの特定の部分文字列を持つURLが必要です。次のコードは、働いていたが、私はそれを行うには、よりエレガントな方法があります確信しています:複数のNOT IN文をPythonで使用する
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
ありがとうございました! docsから
すべて組み込み関数 –