男单 618

生活象筒装的卫生纸,开始的时候怎么扯都不觉得在转,后来转的越来越快。

Ubuntu 9.10下unzip的乱码问题

with one comment

Ubuntu 9.10中unzip升级为6.0,结果原来的-O参数没有了,解压缩Win平台来的带中文文件名的文件时,会有乱码。Google,Baidu无果后,自行使用Python解决。

01 #!/usr/bin/python
02 #coding=utf8
03
04 import zipfile
05 import sys
06
07 if len(sys.argv)<2:
08     print u’punzip zipfilename’
09 else:
10     f=zipfile.ZipFile(sys.argv[1])
11     nlist=f.namelist()
12     for n in nlist:
13         m=unicode(n,’gb2312′).encode(‘utf8′)
14         file(m,’wb’).write(f.read(n))
15     f.close()

只有基本功能,解压缩到当前目录下,不能新建目录……
请自行修改。

无觅相关文章插件

Written by amao

2010/01/01 at 17:56

Posted in linux,python

Tagged with ,

One Response to 'Ubuntu 9.10下unzip的乱码问题'

Subscribe to comments with RSS or TrackBack to 'Ubuntu 9.10下unzip的乱码问题'.

  1. 很cool,以后遇上不好的工具,要增加一种使用python小写一个的思路.

    LOGOLS

    24 九 10 at 4:21 下午

Leave a Reply