Kar*_*ala 6 python r notepad++
我有大约600,000个文件编码ANSI,我想将它们转换为UTF-8.我能做到这一点单独的NOTEPAD++,但我不能这样做,600,000 files.Can我这样做的R还是Python?
我找到了这个链接,但Python脚本没有运行:
notepad ++将ansi编码文件转换为utf-8
小智 6
为什么不读取文件并将其写为UTF-8?你可以用Python做到这一点.
#to support encodings
import codecs
#read input file
with codecs.open(path, 'r', encoding = 'utf8') as file:
lines = file.read()
#write output file
with codecs.open(path, 'w', encoding = 'utf8') as file:
file.write(lines)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10379 次 |
| 最近记录: |