Answer the question
In order to leave comments, you need to log in
How to output all child elements in xml.etree.ElementTree?
import xml.etree.ElementTree as et
import requests
url = 'http://www.cbr.ru/scripts/XML_daily.asp'
root = et.fromstring(requests.get(url).content)
for item in root.findall('.//Valute'):
ids = print(item.attrib.get('ID'))
if ids:
pass
else:
continue
for s in root.findall(".//[@%s]" %ids):
print(s)//нужно чтобы тут выводились все данные о валюте для каждого id по отдельности
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