我正在尝试处理几个文件,通过使用glob库从目录中获取它,它给了我一个错误。我想在尝试解析包含文件名的列表时可能是一个错误。
import xml.etree.ElementTree as et
import pandas as pd
import glob as g
path = g.glob('C:\Users\Desktop\*_LEITURAS*')
data = []
for archiv in path:
for (ev, el) in et.iterparse(archiv):
if el.tag == 'NOME_DISTRITO': nome = el.text
if el.tag == 'NR_CPE': nr = el.text
if el.tag == "LEITURA":
inner = {}
inner['NOME_DISTRITO'] = nome
inner['NR_CPE'] = nr
for i in el:
inner[i.tag] = i.text
data.append(inner)
df = pd.DataFrame(data)
错误:
IPDB> ParseError:ParseErr ... mn 0',),)
有人可以帮我解决这个错误吗?