33 lines
678 B
Python
33 lines
678 B
Python
import requests
|
|
import xml.dom.minidom as minidom
|
|
import xml.etree.ElementTree as ET
|
|
|
|
url = 'https://www.cbr-xml-daily.ru/daily_utf8.xml'
|
|
r = requests.get(url)
|
|
root = ET.fromstring(r.content.decode())
|
|
result = {}
|
|
for child in root:
|
|
result[child.find("CharCode").text] = child.find("Value").text
|
|
|
|
print(result)
|
|
|
|
|
|
# node = doc.documentElement
|
|
# names = doc.getElementsByTagName("name")
|
|
#
|
|
# my_list = []
|
|
# for name in names:
|
|
# titleObj = book.getElementsByTagName("title")[0]
|
|
# titles.append(titleObj)
|
|
#
|
|
# for title in titles:
|
|
# nodes = title.childNodes
|
|
# for node in nodes:
|
|
# if node.nodeType == node.TEXT_NODE:
|
|
# print(node.data)
|
|
#
|
|
#
|
|
#
|
|
#
|
|
|