title_node = soup.find('dd',class_='lemmaWgt-lemmaTitle-title').find('h1')
title_data = title_node.get_text()
title_data = title_node.get_text()
2018-05-18
print('获取P')
pnode = soup.find_all('p', class_ = 'title')
for link in pnode:
print(link.name, link.get_text)
pnode = soup.find_all('p', class_ = 'title')
for link in pnode:
print(link.name, link.get_text)
2018-05-11
print('获取Lacie的链接')
link_node = soup.find_all('a', href = 'http://example.come/Lacie')
for link in link_node:
print(link.name, link['href'], link.get_text() )
print('正则匹配')
link_node = soup.find_all( 'a', href = re.compile(r"ill") )
for link in link_node:
link_node = soup.find_all('a', href = 'http://example.come/Lacie')
for link in link_node:
print(link.name, link['href'], link.get_text() )
print('正则匹配')
link_node = soup.find_all( 'a', href = re.compile(r"ill") )
for link in link_node:
2018-05-11
# coding = gbk
from bs4 import BeautifulSoup
import re
'''
'''
soup = BeautifulSoup(html_doc, 'html.parser')
print('获取所有的链接:')
links = soup.find_all('a')
for link in links:
print( link.name, link['href'], link.get_text() )
from bs4 import BeautifulSoup
import re
'''
'''
soup = BeautifulSoup(html_doc, 'html.parser')
print('获取所有的链接:')
links = soup.find_all('a')
for link in links:
print( link.name, link['href'], link.get_text() )
2018-05-11
You're probably treating a list of items like a single item. Did you call find_all() when you meant to call find()?
2018-04-29