Apr-24-2022, 04:47 AM
(This post was last modified: Apr-24-2022, 08:46 AM by Gribouillis.)
Please help
import requests import json import sys sys.path.insert(0,'bs4.zip') from bs4 import BeautifulSoup #Imitate the Mozilla browser. user_agent = {'User-agent': 'Mozilla/5.0'} def compare_prices(product_laughs,product_glomark): #TODO: Aquire the web pages which contain product Price #TODO: LaughsSuper supermarket website provides the price in a span text. #TODO: Glomark supermarket website provides the data in jason format in an inline script. #You can use the json module to extract only the price #TODO: Parse the values as floats, and print them. print('Laughs ',product_name_laughs,'Rs.: ' , price_laughs) print('Glomark ',product_name_glomark,'Rs.: ' , price_glomark) if(price_laughs>price_glomark): print('Glomark is cheaper Rs.:',price_laughs - price_glomark) elif(price_laughs<price_glomark): print('Laughs is cheaper Rs.:',price_glomark - price_laughs) else: print('Price is the same')https://ibb.co/MnRbMQT
Gribouillis write Apr-24-2022, 08:46 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.