需要爬取文字标题
在 headers 下面 有 网页,然后Request 是 GET
把 Response 这个里面的文本框复制到 TXT 并保存至 Python 根目录
import requests
res=requests.get('http://esf.sh.fang.com')
#res.text
from bs4 import BeautifulSoup
domain = 'http://esf.sh.fang.com'
soup=BeautifulSoup(res.text,'html.parser')
for house in soup.select('.houseList dl'):
title = house.select('.title')[0].text.strp()
print(domain + house.selec('.title a')[0]['href'])
print("=============")
码了一堆没用的代码
因为网页更新了,但我还没有熟练使用。明天换教程











网友评论