Jetzt habe ich ein Problem bei der Arbeit gefunden. Ich brauche XML-Daten aus http://air4thai.pcd.go.th/services/getAQI_XML.php?region=2 Ich mag XML analysieren und die Ausgabe an CSVXML To CSV Coop Projekt
Und im Neuling in Python jetzt im Test Codierung Parsing PM10 wie diese
import xml.etree.ElementTree as ET
import requests
import os
Air4thaiURL = 'http://air4thai.pcd.go.th/services/getAQI_XML.php?region=2'
resp = requests.get(Air4thaiURL)
msg = resp.content
tree = ET.fromstring(msg)
for station in tree.findall('.//station/LastUpdate'):
print ('{}'.format(
station.get('PM10')))
führen aber wie diese
Keine keine keine keine keine keine keine keine Keine Keine Keine Keine Keine Keine Keine Keine Keine
So ist es muss in Wert/Im versuchen angezeigt eingeben: s es ist Ergebnis
Traceback (most recent call last):
File "C:\Users\Gistda59\Desktop\Coop - Python Script\pm10_XML.py", line 11, in <module>
station.get('PM10')))
TypeError: non-empty format string passed to object.__format__
, wie es ist zu lösen und raten Sie mir, XML zu CSV von dieser URL zu analysieren Vielen Dank, um zu helfen, mein Problem zu lösen.