Notepad++ GBK轉UTF8 python script插件腳本【轉】

轉發同事的一篇 http://note.youdao.com/share/?id=e220c485253ea9481e6d86c2cf8ae288&type=note#/css

大量GBK文件使用notepad++ 的python script插件批量轉換html

ConvertToUtf8.pyjava

import os,time
import sys
console.show()
console.clear()
filePathSrc="D:\\wk\\yunwei\\v4_new\\EMIClient\\src\\main\\java\\com\\jbns\\easymaster\\web1" # Path to the folder with files to convert
check_file_types = ['.java', '.jsp', '.js', '.css', '.xml']
exclude_folders = ['CVS']
for folder, dirs, files in os.walk(filePathSrc):
    if os.path.split(folder)[1] in exclude_folders:
        continue
    for fn in files:
        if os.path.splitext(fn)[1] in check_file_types:
            f1 = os.path.join(folder, fn)
            notepad.open(f1)
            notepad.menuCommand(45010) # look for in localization/chineseSimplified.xml
            notepad.save()
            console.write(f1 + "\n")
            # print f1
            notepad.close()
console.write("success!" + "\n")

Notepad++的正則表達式替換和替換python

相關文章
相關標籤/搜索