欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

python爬取分析超級(jí)大樂(lè)透歷史開(kāi)獎(jiǎng)數(shù)據(jù)第1/2頁(yè)

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

博主作為爬蟲(chóng)初學(xué)者,本次使用了requests和beautifulsoup庫(kù)進(jìn)行數(shù)據(jù)的爬取

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

如圖:

在這里插入圖片描述

爬蟲(chóng)部分

from bs4 import BeautifulSoup #引用BeautifulSoup庫(kù)
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)文章

最新評(píng)論