print("正则匹配")
link_node = soup.find('a', href = re.compile(r"ill"))
print(link_node.name, link_node['href'], link_node.get_text())
link_node = soup.find('a', href = re.compile(r"ill"))
print(link_node.name, link_node['href'], link_node.get_text())
2018-04-04
print("获取lacie的链接")
link_node = soup.find('a', href = 'http://example.com/lacie')
print(link_node.name, link_node['href'], link_node.get_text())
link_node = soup.find('a', href = 'http://example.com/lacie')
print(link_node.name, link_node['href'], link_node.get_text())
2018-04-04
soup = BeautifulSoup(html_doc,'html.parser',from_encoding='utf-8')
print("获取所有的链接")
links = soup.find_all('a')
for link in links:
print(link.name , link['href'],link.get_text())
print("获取所有的链接")
links = soup.find_all('a')
for link in links:
print(link.name , link['href'],link.get_text())
2018-04-04
如果安装了pip 直接在cmd中输入 pip install BeautifulSoup4 。几秒就成功了。
2018-03-31
乱码 添加
fout.write('<meta charset="utf-8">')
fout.write('<meta charset="utf-8">')
2018-03-27
python2可以运行流畅,希望能给你们提供点帮助,带注释
https://github.com/aiyuan-haohao/Python_potato
https://github.com/aiyuan-haohao/Python_potato
2018-03-27