花花世界蕾 发表于 2017-5-8 12:02:48

Python小脚本: 转换DownThemAll下载的文件名中的%E7等字符

# normalize filename of file downloaded by DownThemAll
# convert 'extjs%E7%94%B5%E5%AD%90%E6%95%99%E7%A8%8B' to 'extjs电子教程'
# only tested on Windows XP
from glob import glob
import urllib2
import os
for fn in glob('*%*'):
newfn = urllib2.unquote(fn).decode('utf-8')
print "%s => %s" % (fn, newfn)
os.rename(fn, newfn)
页: [1]
查看完整版本: Python小脚本: 转换DownThemAll下载的文件名中的%E7等字符