簡體   English   中英

Beautifulsoup 數據抓取從網站收集編號

[英]Beautifulsoup data scraping collect number from website

我想用 beautifulsoup 來提取號碼。 我的代碼如下:

future=data3.find_all('span',class_='instrument-price_last__KQzyA')
    
print(future)

它將返回:

span class="instrument-price_last__KQzyA" data-test="instrument-price-last">23,989.5</span

如何從這些信息中提取 23989.5? 謝謝。

使用text屬性:

future = float(data3.find_all('span',class_='instrument-price_last__KQzyA').text.replace(',', ''))

和:

print(future)

會給:

23989.5

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM