[英]Scraping data from different tabs of a website using requests and 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.