I need to URLs with three specific specific substrings out of a loop. The following code worked, but I am sure there's a more elegant way to do it:
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
Thank you!
From the docs:
any
returns True if any element of the iterable is true. If the iterable is empty, return False. Equivalent to: