[Solved] Beautifulsoup: Is it possible to get tag name and attribute name by its value? [closed]
You could define a filter function that checks if there is one HTML tag with a attribute value equal to value: def your_filter(tag, value): for key in tag.attrs.keys(): if tag[key] == value: return True return False # alternatively as one liner: def your_filter(tag, value): return any(tag[key] == value for key in tag.attrs.keys()) Then, you could … Read more