提取豆瓣出版社信息并写入文件

# 提取豆瓣出版社信息并写入文件
import urllib.request
import re
date=urllib.request.urlopen("https://read.douban.com/provider/all").read().decode("utf-8")
pat='<div class="name">(.*?)</div>'
rsp=re.compile(pat).findall(date)
fb=open("C:/Users/Administrator/Desktop/出版社.txt","w")
for i in range(len(rsp)):
    fb.write(rsp[i]+"\n")
fb.close()

 

posted @ 2019-07-25 17:30  Peach~  阅读(226)  评论(0编辑  收藏  举报