This commit is contained in:
Denis Zheleztsov 2018-06-20 16:01:16 +03:00
commit b5bf76908a
2 changed files with 33 additions and 0 deletions

32
parser.py Normal file
View File

@ -0,0 +1,32 @@
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)
#
#
#
#

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
requests