beautifusouptest

from bs4 import BeautifulSoup
import urllib.request
url = "http://www.douban.com/tag/%E5%B0%8F%E8%AF%B4/?focus=book"
res = urllib.request.urlopen(url)

soup = BeautifulSoup(res,'lxml')
book_div = soup.find(attrs={'id':"book"})
book_a = book_div.findAll(attrs={"class":'desc'})
for book in book_a :
print(book.string)
posted @ 2018-01-19 16:48  brady-wang  阅读(276)  评论(0编辑  收藏  举报