[問題] 爬蟲下載表格

看板Python作者 (E邊緣人)時間6年前 (2019/04/05 19:51), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
大家好 我想利用爬蟲把網頁上的表格下載下來 前一天還可以下載 但是今天一樣的程式卻無法執行 問題出現在select_one抓不到標籤 我回頭看網頁的原始碼但找不到錯誤 希望有高手可以解答一下 謝謝 程式碼: from selenium import webdriver from bs4 import BeautifulSoup import pandas as pd driver = webdriver.Chrome("./chromedriver") driver.implicitly_wait(10) driver.get("http://rdc28.cwb.gov.tw/TDB/ntdb/pageControl/typhoon") soup = BeautifulSoup(driver.page_source, "lxml") table = soup.select_one( "body > div#wrapper_ex > div#wrapper > div#main > div.content2 > div.tyde > table") print(table) df = pd.read_html(str(table)) df[0].to_csv("typhoon.csv") print("儲存頁面ing") driver.quit() -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 110.28.11.240 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1554465086.A.4F2.html
文章代碼(AID): #1Sfq4-Jo (Python)
文章代碼(AID): #1Sfq4-Jo (Python)