Created
January 25, 2016 08:39
-
-
Save huangziwei/13f9e14b478a44a5e21d to your computer and use it in GitHub Desktop.
.txt 乱码解决方案
This file contains 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
import sys | |
import codecs | |
input_file = sys.argv[1] | |
with codecs.open(input_file, 'r', encoding='gbk') as f: | |
out_name = 'new' + f.name | |
with codecs.open(input_file, 'w', encoding='utf-8') as o: | |
for i in f.readlines(): | |
o.write(i) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment