爬取 https://read.douban.com/provider/all 上的出版商

网页源码格式为:

python 程序如下:


结果如下:

可复制代码如下:
import re
import urllib.request
data=urllib.request.urlopen("https://read.douban.com/provider/all").read()
data=data.decode()
pat='<div class="name">(.*?)</div>
mydata=recompile(pat).findall(data)
mydata
file=open("E:/py/data/da.txt","w")
for i in range(0,len(mydata)):
file.write(mydata[i]+"\n")
file.close()
网友评论