Trying to use BeautifulSoup to learn python

Solution 1:

as per the url provided in the question, I could see the price with $ symbol is available in the price-current class name.

So I have used a find_all() to get all the prices.

Use the below code:

import requests
from bs4 import BeautifulSoup

url = "https://www.newegg.com/core-i7-8th-gen-intel-core-i7-8700k/p/N82E16819117827?Item=N82E16819117827"

result = requests.get(url)
doc = BeautifulSoup(result.text, "html.parser")

price = doc.find_all(attrs={'class': "price-current"})
for p in price:
    print(p.text)

output:

$399.99

$400.33
$403.09
$412.00