資源簡介
代碼片段和文件信息
import?requests
from?lxml?import?etree
import?os
#encoding=‘utf8‘
#?https://fs.58.com/shiwan/ershoufang/?PGTID=0d30000c-0322-dc0a-59e2-da34327e54fc&ClickID=1
#?https://fs.58.com/shiwan/ershoufang/pn2/?PGTID=0d30000c-0322-d6ac-cad7-e391a44ac4b2&ClickID=1
#?https://fs.58.com/shiwan/ershoufang/pn3/?PGTID=0d30000c-0322-d3e9-1e15-c9e8fef23e85&ClickID=1
header={
‘Connection‘:‘close‘
‘User-Agent‘:‘Mozilla/5.0?(Windows?NT?10.0;?Win64;?x64)?AppleWebKit/537.36?(KHTML?like?Gecko)?Chrome/75.0.3770.142?Safari/537.36‘
}
#??文件夾
#?if?not?os.path.exists(‘./58二手房信息.csv‘):
#?????os.mkdir(‘./58二手房信息.csv‘)
fp?=?open(‘./58二手房信息.csv‘?‘w‘?encoding=‘utf8‘)
for?page?in?range(16):
????if?page?==?1:
????????url?=?‘https://fs.58.com/shiwan/ershoufang/?PGTID=0d30000c-0322-dc0a-59e2-da34327e54fc&ClickID=1‘
????else:
????????url?=?‘https://fs.58.com/shiwan/ershoufang/pn{}/?PGTID=0d30000
- 上一篇:python 經典款打飛機
- 下一篇:圖形界面萬年歷
評論
共有 條評論