Last active
April 13, 2018 15:14
-
-
Save SuoXC/2cf4e7a82810a1a261e6ec7e344dd84a to your computer and use it in GitHub Desktop.
python 修改文本文件编码
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gbk_to_utf8(source, target): | |
with open(source, "r", encoding="gbk") as src: | |
with open(target, "w", encoding="utf-8") as dst: | |
for line in src.readlines(): | |
dst.write(line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment