I working on a beautifulsoup finding of all elements that are related to static.
What is the list of all static-related tags and elements?
Is there any other way apart from finding by multiple BeautifulSoup.findAll()
with different arguments?
my current best version looks like
stitic_ = souped.findAll('link', rel='stylesheet') +
souped.findAll('img') +
souped.findAll('script') +
souped.findAll('video')
if it’s only correct, maybe there are some elements I passed through.
2
Answers
Note: In newer code avoid old syntax
findAll()
instead usefind_all()
orselect()
– For more take a minute to check BeautifulSoup docsSo based on your question you could chain your tags:
find_all
accepts a function as parameter that can be used to filters the tags, see doc.