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

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -