您的位置:首页 > 编程语言 > Python开发

Notepad++ GBK转UTF8 python script插件脚本【转】

2017-11-02 00:00 399 查看
转发同事的一篇
http://note.youdao.com/share/?id=e220c485253ea9481e6d86c2cf8ae288&type=note#/

大量GBK文件使用notepad++ 的python script插件批量转换

ConvertToUtf8.py

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++的正则表达式替换和替换
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  GBK UTF8 NOTEPAD++