Hi, there:
I’m trying to retrieve the air quality data from local government’s website opendata2.epa.gov.tw/AQX.xml. Since I need only the data from a specific site, what I have to do is to search the site, extract all the site data, and parse specific index.
Based on the python documentation docs.python.org/3.5/library/xml … ttree.html
I came to some code like this:
import xml.etree.ElementTree as ET
def valueChange(channel, sampleIndex, val, prev):
tree = ET.parse('http://opendata2.epa.gov.tw/AQX.xml')
if tree.find('siteName').text equl '中山'
siteRoot = tree.getroot()
PM2_5 = root.find('PM2.5').text
op('webValue').par.value0 = int(PM2_5)
return
Unfortunately the xml.etree.ElementTree module cause problem and the chinese character cannot be properly handled by TD’s DAT.
Is there anyone has any ideas?
Many thanks in advance!
adenovirux