soup.find()
from bs4 import BeautifulSoup?
import re
print u'獲取Lacie的鏈接'
link_node = soup.find('a', herf = 'http://example.com/lacie')
print link_node.name,link_node['href'],link_node.get_text()
報(bào)錯(cuò):
Traceback (most recent call last): ?File "libar.py", line 28, in
print link_node.name,link_node['href'],link_node.get_text() AttributeError: 'NoneType' object has no attribute 'name'?
求助各位大神
2017-12-19
找到了……h(huán)ref拼錯(cuò)了