Home python PARTER PRICE PYTHON BS4

PARTER PRICE PYTHON BS4

Author

Date

Category

[! [page] [1]] [1]

It is necessary to steal the price of 49990 without “p” and that this is the number, not the text
[1]: https://i.stack.imgur.com/eabgt.png


Answer 1

It seems like it works: D

import requests, fake_useragent
From BS4 Import Beautifulsoup
url = 'https://shop.mts.ru/product/smartfon-apple-iphone-11-new-128gb-fioletovyj'
User_Agent = {'User-Agent': fake_useragent.useragent (). Random}
Responsive = Requests.Get (URL, Headers = User_Agent)
HTML = Beautifulsoup (Responsive.Text, 'Html.Parser')
information = html.find ('Span', class _ = 'Product-Price__CURRENT'). Get_Text (strip = True)
Price = ''
For i in information:
   If i.isdigit ():
     Price + = I
Print (Price)

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions