Python解压缩zip文件,解决乱码问题,pythonzip,Python语言: Py


Python语言: Python解压缩zip文件,解决乱码问题

#!/usr/bin/python#coding=utf8import zipfileimport sysif len(sys.argv)<2:    print u'punzip zipfilename'else:    f=zipfile.ZipFile(sys.argv[1])    nlist=f.namelist()    for n in nlist:        m=unicode(n,'gb2312').encode('utf8')        file(m,'wb').write(f.read(n))    f.close()

评论关闭