0
下面的代碼:LXML ns_clean =真不出現工作
NAMESPACES = {'ns': 'http://www.starstandard.org/STAR/5', 'ns1': 'http://www.openapplications.org/oagis/9'}
ro_xml = '{}.xml'.format(6001265)
parser = etree.XMLParser(ns_clean=True)
tree = etree.parse(ro_xml)
root = etree.tostring(tree.getroot())
# print root
residence = []
residence_address = '//ns:ResidenceAddress/*'
shop_supplies_amount = tree.xpath(residence_address, namespaces=NAMESPACES)
for child in shop_supplies_amount:
residence.append("%s: %s" % (child.tag, child.text))
print residence
當我運行此我得到的命名空間中的標籤名稱的前面,像這樣'{http://www.starstandard.org/STAR/5}LineOne: 10757 RIVER FRONT PARKWAY'
我在做什麼錯誤以及如何擺脫標籤名稱前的命名空間