小编Ben*_*evy的帖子

错误:在 r 中使用 xmlToDataFrame 时出现“列的重复下标”

我正在解析 xml 文件,其中包含以下几行:

xmlData = xmlParse( paste( dataDirStr, fileName, '.xml', sep='' ) )
Run Code Online (Sandbox Code Playgroud)

到目前为止,一切都很好。但是这个:

listData = xmlToDataFrame( xmlData )
Run Code Online (Sandbox Code Playgroud)

产生这个不幸的消息:

[<-.data.frame( tmp , i, names(nodes[[i]]), value = c("4B6EW", : 列的重复下标)中出现错误

xml洛克希德·马丁公司每天都会使用该文件,因此他们必须有办法处理这个问题。有什么帮助吗?

xml r nodes dataframe xml-parsing

6
推荐指数
0
解决办法
5139
查看次数

使用 zipfile 的 Python 错误:'list' 对象没有属性 'tell'

我正在尝试使用以下代码在目录中仅压缩 *.csv 文件:

allFiles = os.listdir( dirName + apt + '/' )
csvList  = [i for i in allFiles if i.endswith('.csv')]
zf       = zipfile.ZipFile([ dirName + apt + '.zip' ], mode='w')
for f in csvList:
    a    = dirName + apt + '/' + f
    zf.write( a )
#all the elements of a are strings
Run Code Online (Sandbox Code Playgroud)

我收到错误:

Traceback (most recent call last):
File "<ipython-input-43-ebf4dc807b56>", line 1, in <module>
zf.write(a)
File "C:\Users\blevy\MCR\WinPython-64bit-3.4.3.5\python-3.4.3.amd64\lib\zipfile.py", line 1347, in write
zinfo.header_offset = self.fp.tell()    # Start of header …
Run Code Online (Sandbox Code Playgroud)

python zip list attributeerror tell

2
推荐指数
1
解决办法
4036
查看次数

标签 统计

attributeerror ×1

dataframe ×1

list ×1

nodes ×1

python ×1

r ×1

tell ×1

xml ×1

xml-parsing ×1

zip ×1