提取豆瓣出版社信息并写入文件
# 提取豆瓣出版社信息并写入文件 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()