当前位置: 首页 > 工具软件 > downthemall > 使用案例 >

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

宫弘亮
2023-12-01
# 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)
 类似资料: