def start_element(name, attrs): global res if name == 'yweather:location': res = attrs def parseXml(xml_str): parser = ParserCreate() parser.StartElementHandler = start_element parser.Parse(xml_str) return res
相比起来,可能用类的方法会更好,请大神指点。
Sign in to make a reply
gd83594394
相比起来,可能用类的方法会更好,请大神指点。