为了账号安全,请及时绑定邮箱和手机立即绑定

Python新手,问题多多啊,用的是Python3.3

Python新手,问题多多啊,用的是Python3.3

慕斯709654 2018-07-03 21:08:39
源码: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
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 1386 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信