我正在使用python。我正在学习beautifulsoup &我正在解析一个链接。使用beautifulsoup获取电子邮件ID
我的网址:
http://www.dtemaharashtra.gov.in/approvedinstitues/StaticPages/frmInstituteSummary.aspx?InstituteCode=1002
我想从URL解析电子邮件ID。
我该怎么做?
我正在使用python。我正在学习beautifulsoup &我正在解析一个链接。使用beautifulsoup获取电子邮件ID
我的网址:
http://www.dtemaharashtra.gov.in/approvedinstitues/StaticPages/frmInstituteSummary.aspx?InstituteCode=1002
我想从URL解析电子邮件ID。
我该怎么做?
import urllib2
from bs4 import BeautifulSoup
html = urllib2.urlopen('http://www.dtemaharashtra.gov.in/approvedinstitues/StaticPages/frmInstituteSummary.aspx?InstituteCode=1002').read()
soup = BeautifulSoup(html)
print soup.find(id='ctl00_rightContainer_ContentBox1_lblEMailAddress').text
感谢它的工作 – sam
import requests
from bs4 import BeautifulSoup
r = requests.get("http://www.dtemaharashtra.gov.in/approvedinstitues/StaticPages/frmInstituteSummary.aspx?InstituteCode=1002")
soup = BeautifulSoup(r.text)
soup.find("span", {"id":"ctl00_rightContainer_ContentBox1_lblEMailAddress"}).text
什么电子邮件ID? [email protected]? –
是的,我想获取该电子邮件ID – sam
你是垃圾邮件发送者吗? – tripleee