PYTHON: zipFile返回zipfile.BadZipfile: 文件不是一个zip文件linux

2024-09-28 03:24:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我有这个python代码:

if '.zip' in add:
    print 'Found ' + add + ' archive. We will do nothing.'
    unZipFileName = add
    z = zipfile.ZipFile(unZipFileName) // here i got the error
    for name in z.namelist():
        outpath = unZipFileName + '/'
        z.extract(name, outpath)

我打印了os.path.isfile(add)并返回True。
我在windows上使用了相同的代码,而且它很管用。
如果归档是在windows上创建的,而我试图在linux上解包,这是个问题?在


Tags: 代码nameinaddifwindowszipdo

热门问题