[問題] 新手爬蟲抓資料

看板Python作者 (不了不了)時間9年前 (2016/08/03 22:20), 編輯推噓0(003)
留言3則, 2人參與, 最新討論串1/1
各位先進好,小弟最近看了一些爬蟲相關的影片 想說照著如法炮製,但遇到了抓取資料的問題 http://www.cnyes.com/graph/historyprice.asp 想要抓的是上面網頁每日的開高低收資料 用的是最近學到的bs4 開了google去抓,但是一直不知道開盤價下面那個數字欄位屬於哪個class 用了t10,t12好像都不對 想請版上大大指點迷津一下,謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.250.201.21 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1470234057.A.BEF.html

08/03 22:50, , 1F
pre_p = soup.find(class_="t12", string="開盤").parent
08/03 22:50, 1F

08/03 22:50, , 2F
pre_p.next_sibling.find("td").string
08/03 22:50, 2F

08/03 23:08, , 3F
謝謝 z大 我再試試 感恩
08/03 23:08, 3F
文章代碼(AID): #1NeVt9ll (Python)
文章代碼(AID): #1NeVt9ll (Python)