打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
解决linux,unzip 解压后中文名出现乱码现象
注意: 如果是linux下压缩的 zip文件,不用一下方法,直接用unzip命令即可。
拷贝一下内容,并将其粘帖至 /usr/bin/uzip
添加执行权限:  chmod +x /usr/bin/uzip
解压命令:  uzip 文件名.zip     (不是unzip哦)
#!/usr/bin/env python# -*- coding: utf-8 -*-# uzip.pyimport osimport sysimport zipfileprint "Processing File " + sys.argv[1]file=zipfile.ZipFile(sys.argv[1],"r");for name in file.namelist():    utf8name=name.decode('gbk')    print "Extracting " + utf8name    pathname = os.path.dirname(utf8name)    if not os.path.exists(pathname) and pathname!= "":        os.makedirs(pathname)    data = file.read(name)    if not os.path.exists(utf8name):        fo = open(utf8name, "w")        fo.write(data)        fo.closefile.close()
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
几个提高工作效率的Python内置小工具
Linux 必学的重要命令
如何利用云服务器搭建个人网站
ubuntu linux zip和unzip类命令详解
电子取证中如何查找加密压缩文件?——以linux为视角
我使用过的Linux命令之dirname
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服