Support Forums

Full Version: Fetch data from a web page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello!

I´d appreciate it if you could help me out.

I need to fetch air pollutant concentrations from the following site:

http://siga.jalisco.gob.mx/ramag/ImecasParticulasR.aspx

I tryed the following code, but, since the concentrations are not in the main html, I get nothing.


import urllib
import re

htmlfile = urllib.urlopen('The site above')

htmltext = htmlfile.read()

print htmltext

regex = '<div style="WIDTH:223.48mm;">(.+?)</div>'

pattern = re.compile(regex)


print pattern

con = re.findall(pattern, htmltext)


print con
I tryied this just to see if I could retrieve something, but I only get an empty list.


import urllib
import re

htmlfile = urllib.urlopen('http://siga.jalisco.gob.mx/aire/tablasCon.html')

htmltext = htmlfile.read()

print htmltext

regex = '<div style="WIDTH:223.48mm;">(.+?)</div>'

pattern = re.compile(regex)


print pattern

con = re.findall(pattern, htmltext)


print con