各位大神好,小弟上次問了問題卻沒有附上程式碼
還是有前輩願意回答 先謝謝
附上程式碼 以及我想做的事
從 玩股網的這個頁面
抓出*美林這個券商在 股票1101的進出明細
小弟目前做出來的方法
只能跑出 含有<td class="up">+150</td>.....
這樣的結果
想請問要怎麼做才能夠只選出 數字 然後將數字結果全部加總呢??
*電腦排版 手機可能格式會跑掉
在此感謝之前回應過的大神們 但小弟不才 python目前正在學習階段
有請大神們幫幫忙 謝謝
# -*- coding: utf-8 -*-
from selenium import webdriver
from bs4 import BeautifulSoup
from selenium.webdriver.support.ui import Select
import time
driver = webdriver.Chrome()
driver.get('https://www.wantgoo.com/stock/agentsata?types=8')
time.sleep(0.5)
driver.find_element_by_id("broker").click()
Select(driver.find_element_by_id("broker")).select_by_visible_text(u"美林")
time.sleep(0.5)
driver.find_element_by_id("stock").click()
Select(driver.find_element_by_id("stock")).select_by_value('1101') #index(int)
time.sleep(0.5)
driver.find_element_by_id("sendSubmit").click()
time.sleep(0.5)
html = driver.page_source
sp = BeautifulSoup(html,'lxml')
def has_class_but_no_id(tag):
return tag.has_attr('class') and not tag.has_attr('id')
data = sp.find(id = "datalist")
qq = data.find_all(has_class_but_no_id)
print (qq)
driver.close()