【发布时间】:2013-12-03 21:46:08
【问题描述】:
我在从以下链接中抓取地址时遇到困难,请帮我抓取地址。
http://www.salatomatic.com/d/Revesby+17154+Ahlus-Sunnah-Wal-Jamaah-Revesby
以上网页链接的源代码如下
<td width="100%"><div class="titleBM">Bankstown Masjid </div>Meredith Street, Bankstown, New South Wales 2200</td>
我试图在</div> 之后立即刮取价值
我当前的代码没有完成,但看起来像跟随
content1 = urllib2.urlopen(url1).read()
soup1 = BeautifulSoup(content1)
div1 = soup1.find('div', {'class':'titleBM'}) #get the div where it's located
span1 = div1.find('</div>')
pos1 = span1.text
print datetime.datetime.now(), 'street address: ' , pos1)
【问题讨论】:
标签: python beautifulsoup scrape