beautifulsoup - python - bs4 grab only certain links -



beautifulsoup - python - bs4 grab only certain links -

<a title="dynamic link" href="test.php">text</a>

how can grab ones have title tag illustration above?

you can utilize select method commonly-used css selector:

>>> bs4 import beautifulsoup >>> html = ''' ... <html> ... <body> ... <a title="dynamic link" href="test1.php">text</a> ... <a href="test2.php">text</a> ... </body> ... </html> ... ''' >>> soup = beautifulsoup(html) >>> soup.select('a[title]') [<a href="test1.php" title="dynamic link">text</a>]

python beautifulsoup

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

SQL Server : need assitance parsing delimted data and returning a long concatenated string -