1. 程式人生 > >爬蟲學習——1

爬蟲學習——1

python爬去小說

re requests target = (urlname): url = target + url ###組合網站urlcontent = requests.get(url).textcontent = re.search(content) text = content.group() text = re.sub(text) result = re.sub(text) (+name) () f: f.write(result) f.close() (): url = response = requests.get(url) html = response.texthtml = re.findall(html) i = line html: i < : i = i + :zhengwen(line[]line[]) ###爬去目錄的url mulu()


爬蟲學習——1