soup = BeautifulSoup(html_doc,'html.parser',from_encoding='utf8')
NameError: name 'BeautifulSoup' is not defined
NameError: name 'BeautifulSoup' is not defined
2016-04-24
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()
2016-04-23
感觉一开始在main那就开始一步到位的写所需要的方法已经类等亚历山大
看完跟着写,自己不细心给搞错了
需要代码的可以看这里:https://github.com/hisen-yuan/PythonPractice/tree/master/src/baike_spider
看完跟着写,自己不细心给搞错了
需要代码的可以看这里:https://github.com/hisen-yuan/PythonPractice/tree/master/src/baike_spider
2016-04-21