python学习,爬去豆瓣出版社

import urllib.request
url=urllib.request.urlopen("https://read.douban.com/provider/all").read()
url=url.decode("utf-8")

import re
pat='
(.*?)
' data=re.compile(pat).findall(url) print(data) wri=open("E:/practice/pc.txt","w") for i in range(0,len(data)): wri.write(data[i]+"\n") wri.close()

 

你可能感兴趣的:(python基础)