亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

python爬取分析超級大樂透歷史開獎數(shù)據(jù)第1/2頁

 更新時間:2021年02月24日 15:11:12   作者:神拳小江南阿  
這篇文章主要介紹了python爬取分析超級大樂透歷史開獎數(shù)據(jù),本次使用了requests和beautifulsoup庫進行數(shù)據(jù)的爬取,通過實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下

博主作為爬蟲初學者,本次使用了requests和beautifulsoup庫進行數(shù)據(jù)的爬取

爬取網(wǎng)站:http://datachart.500.com/dlt/history/history.shtml —500彩票網(wǎng)
(分析后發(fā)現(xiàn)網(wǎng)站源代碼并非是通過頁面跳轉(zhuǎn)來查找不同的數(shù)據(jù),故可通過F12查找network欄找到真正儲存所有歷史開獎結(jié)果的網(wǎng)頁)

如圖:

在這里插入圖片描述

爬蟲部分

from bs4 import BeautifulSoup #引用BeautifulSoup庫
import requests     #引用requests
import os      #os
import pandas as pd
import csv
import codecs

lst=[]
url='http://datachart.500.com/dlt/history/newinc/history.php?start=07001&end=21018'
r = requests.get(url)      
r.encoding='utf-8'
text=r.text
soup = BeautifulSoup(text, "html.parser")
tbody=soup.find('tbody',id="tdata")
tr=tbody.find_all('tr')
td=tr[0].find_all('td')
for page in range(0,14016):
 td=tr
                            
                            

                        

相關(guān)文章

最新評論