就像我说的,这是一个非常奇怪的问题。我希望你们能帮我解决这个问题谢谢
以下是我的代码:
import os
import zipfile
filename = "E:\\test.zip"
currdir = "E:\\vpn\\"
os.chdir(currdir)
tfile = zipfile.ZipFile(filename, 'w')
files = os.listdir(currdir)
for f in files:
tfile.write(f)
for f in tfile.namelist():
print "added %s"%f
tfile.close()
错误信息:
Traceback (most recent call last):
File "C:\pydemo\src\gzip\zipfile.py", line 7, in <module>
import zipfile
File "C:\pydemo\src\gzip\zipfile.py", line 14, in <module>
tfile = zipfile.ZipFile.(filename, 'w')
AttributeError: 'module' object has no attribute 'ZipFile'