Python 3.5
See the code
import urllib.request
from xml.etree import ElementTree as ET
url = 'http://www.sat.gob.mx/informacion_fiscal/tablas_indicadores/Paginas/tipo_cambio.aspx'
def conectar(url):
page = urllib.request.urlopen(url)
return page.read()
root = ET.fromstring(conectar(url))
s = root.findall("//*[contains(.,'21/')]")
A need extract '21/', but return this error:
Erro:
Traceback (most recent call last):
File "crawler.py", line 11, in <module>
root = ET.fromstring(conectar(url))
File "/home/rg3915/.pyenv/versions/3.5.0/lib/python3.5/xml/etree/ElementTree.py", line 1321, in XML
parser.feed(text)
xml.etree.ElementTree.ParseError: unbound prefix: line 146, column 8
But I do not know how to solve this error.