Python Forum
Help on parsing simple text on HTML
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help on parsing simple text on HTML
#1
Hello Everyone,

I've been trying to parse an HTML page in order to get a simple price but I can't succeed, I tried to get help from youtube tutorials and from many websites but I need your help.

page_options_cac40 ="https://live.euronext.com/fr/product/index-options/PXA-DPAR"
import bs4
import requests
from bs4 import BeautifulSoup

def get_all_strikes():
    r=requests.get(page_options_cac40)
    page = bs4.BeautifulSoup(r.text,"html.parser")
    
    #<td class=" font-weight-bold">4400.00</td> <--- line with the code and the strike to find
    
    premier_strike = page.find('td', attrs={'class': 'font-weight-bolde'})
    print(premier_strike)
I'd like to get the first strike price which is 4400. The code runs but returns "None"....
Thank you very much in advance.

Happy new year
Reply


Messages In This Thread
Help on parsing simple text on HTML - by amaumox - Jan-02-2020, 08:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  HTML multi select HTML listbox with Flask/Python rfeyer 0 4,636 Mar-14-2021, 12:23 PM
Last Post: rfeyer
  Parsing html page and working with checkbox (on a captcha) straannick 17 11,317 Feb-04-2021, 02:54 PM
Last Post: snippsat
  Any way to remove HTML tags from scraped data? (I want text only) SeBz2020uk 1 3,472 Nov-02-2020, 08:12 PM
Last Post: Larz60+
  Help: Beautiful Soup - Parsing HTML table ironfelix717 2 2,692 Oct-01-2020, 02:19 PM
Last Post: snippsat
  Python3 + BeautifulSoup4 + lxml (HTML -> CSV) - How to loop to next HTML/new CSV Row BrandonKastning 0 2,365 Mar-22-2020, 06:10 AM
Last Post: BrandonKastning
  Web crawler extracting specific text from HTML lewdow 1 3,404 Jan-03-2020, 11:21 PM
Last Post: snippsat
  Extract text between bold headlines from HTML CostasG 1 2,328 Aug-31-2019, 10:53 AM
Last Post: snippsat
  Getting a specific text inside an html with soup mathieugrimbert 9 15,932 Jul-10-2019, 12:40 PM
Last Post: mathieugrimbert
  XML Parsing - Find a specific text (ElementTree) TeraX 3 4,059 Oct-09-2018, 09:06 AM
Last Post: TeraX
  Beutifulsoup: how to pick text that's not in HTML tags? pitonas 4 4,722 Oct-08-2018, 01:43 PM
Last Post: pitonas

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020