Skip to content

Instantly share code, notes, and snippets.

@SuoXC
Last active April 13, 2018 15:14
Show Gist options
  • Save SuoXC/2cf4e7a82810a1a261e6ec7e344dd84a to your computer and use it in GitHub Desktop.
Save SuoXC/2cf4e7a82810a1a261e6ec7e344dd84a to your computer and use it in GitHub Desktop.
python 修改文本文件编码
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