My question is how to get Unique values from second for loop.
It repeated the results equal to the number of tags in the first for loop, and I need unique values (Just one from each result)
for menu in soup.findAll(['span','div','li','ul','nav','p'], {'class':[ re.compile("item" ,re.IGNORECASE),re.compile("menu" ,re.IGNORECASE),re.compile("catego" ,re.IGNORECASE),re.compile("mega" ,re.IGNORECASE),re.compile("main" ,re.IGNORECASE),re.compile("search" ,re.IGNORECASE),re.compile("rela" ,re.IGNORECASE),re.compile("nav" ,re.IGNORECASE),re.compile("prim" ,re.IGNORECASE)]}):
for link in menu.find_all('a'):
print(link.text)
print(link['href'])
My result is :
میز پینگ پنگ
چوب راکت پینگ پنگ
رویه راکت پینگ پنگ
And so many other links with tags but repeated after some iterations.
Thanks in advance for any help.