dui,昨天沒寫 —————————華麗的分割線————————————— 今天的內(nèi)容,獲取評論數(shù),網(wǎng)站是“http://news.sina.com.cn/c/gat/2...
dui,昨天沒寫 —————————華麗的分割線————————————— 今天的內(nèi)容,獲取評論數(shù),網(wǎng)站是“http://news.sina.com.cn/c/gat/2...
開頭 怎么說 慢慢學吧 開始 對網(wǎng)址進行剖析 URL =news.sina.com.cn/c/nd/2018-01-15/doc-ifyqptqv9660647.shtml...
python的api文檔:https://docs.python.org/3/search.html?q=requests 1.requests 2.bs4 Beautifu...
還是先放圖(網(wǎng)頁) 可以看出新聞在div為id=news-item 然后在H2標題的a標簽中 示例代碼 可以看到直接獲取a標簽里的東西 1.獲取a標簽 news-item中 ...
先上圖 結果 1.導入requests 2.導入beautifulsoup 3.用requests獲取網(wǎng)站get方法 4.設置編碼encoding=‘utf-8’ 5.傳進b...