What do you want to save?
Add Code snippet
New code examples
-
Python 2021-11-13 10:37:10
python webscraper stack overflow
import urllib2 from BeautifulSoup import BeautifulSoup # or if you're using BeautifulSoup4: # from bs4 import BeautifulSoup soup = BeautifulSoup(urllib2.urlopen('http://example.com').read()) for row in soup('table', {'class': 'spad'})[0].tbody('tr'): ... Add solution -
-
Python 2021-11-06 20:08:24
iterate over meta tag python
import urllib.request from bs4 import BeautifulSoup f = open('out.txt','w') url = "http://www.international.gc.ca/about-a_propos/atip-aiprp/reports-rapports/2012/02-atip_aiprp.aspx" page = urllib.request.urlopen(url) soup = BeautifulSoup(page... Add solution -
Other 2021-11-06 07:36:26
tag inside tag beautifulsoup
html = """<div class="pr"> </div> <li> <a href="pr/protocol"> protocol </a> </li>""" soup = BeautifulSoup(html, "lxml") a = soup.select_one("div[cl... Add solution -
Python 2021-11-05 10:04:12
beautifulsoup4
from bs4 import BeautifulSoup # works very well with Requests or urllib module # Quick Start from bs4 import BeautifulSoup soup = BeautifulSoup("<p>Some<b>bad<i>HTML") print(soup.prettify()) #OUTPUT: <html> <body&g... Add solution