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
Post a Comment