开发一个豆瓣图书搜索系统用Python编写
发布时间
阅读量:
阅读量
import requests
import time
from bs4 import BeautifulSoup
import re
book=[]
def search(url):
try:
#url='https://book.douban.com/tag/%E6%97%A5%E6%9C%AC%E6%96%87%E5%AD%A6'
r=requests.get(url)
html=r.text
return html
except:
search(url)
def parse_page(url,k):
html=search(url)
pattern1=re.compile('<div class="pub">(.*?)</div>',re.S)
book_info=re.findall(pattern1,html)
pattern2=re.compile('title="(.*?)"',re.S)
book_name=re.
全部评论 (0)
还没有任何评论哟~
