源码:import zipfileimport osimport timesource_dir = os.listdir(os.getcwd())target=time.strftime('%Y%m%d%H%M%S') + '.zip'myZipFile = zipfile.ZipFile(target,'w')for root,dirs,files in os.walk(source_dir):for vfileName in files:fileName = os.path.join(root,vfileName)myZipFile.write( fileName, fileName, zipfile.ZIP_DEFLATED )print ( myZipFile.printdir() ) #print all files in zhe zip file,myZipFile.close()提示错误:Traceback (most recent call last):File "C:\Users\月\Desktop\Test\yasuo.py", line 9, in <module>for root,dirs,files in os.walk(source_dir):File "C:\Python33\lib\os.py", line 404, in walknames = listdir(top)TypeError: illegal type for path parameter
添加回答
举报
0/150
提交
取消