python - Can you return tags where condition is not met in BeautifulSoup? -
i'm trying input
tags page, don't want return type attribute, hidden
.
i can hidden
fields soup.find_all('input', attrs={'type': 'hidden'})
can't negate attrs!={'type': 'hidden'}
.
is there simple one-liner way of getting tags don't match condition on given attribute?
you'll have use function match:
def input_not_type_hidden(tag): return tag.name == 'input' , tag.get('type') != 'hidden' soup.find_all(input_not_type_hidden)
Comments
Post a Comment