Answer the question
In order to leave comments, you need to log in
How to extract numbers from a tag?
I want to get the central bank rate without using beautiful soup.
I parsed the page and using regular expressions I try to pull out the dollar rate, but it only comes out with tags for me
import requests
import re
import pprint
url = 'https://www.cbr.ru/currency_base/daily/'
request = requests.get(url)
data = request._content.decode('utf-8')
match = re.search(r'Доллар США.*?(\d+,\d+)', data, re.IGNORECASE | re.DOTALL)
pprint.pprint(match)
<re.Match object; span=(19252, 19290), match='Доллар США</td>\r\n <td>76,1535'>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question