Skip to content

Instantly share code, notes, and snippets.

@zed
Created December 18, 2013 15:01
Show Gist options
  • Select an option

  • Save zed/8023740 to your computer and use it in GitHub Desktop.

Select an option

Save zed/8023740 to your computer and use it in GitHub Desktop.
"""Show that a list argument can find multiple (different) tags."""
from bs4 import BeautifulSoup
soup = BeautifulSoup("""<!doctype html>
<title>Search multiple tags</title>
<i>i</i><b>b</b>""")
print(soup.find_all('i')) # only i
print('i'*60)
print(soup.find_all('b')) # only b
print('b'*60)
print(soup.find_all(['i','b'])) # both
print('ib'*30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment