标签:coding ima water roc 分享图片 ges 技术 encode FN
from os import listdir
from chardet import detect
fns = (fn for fn in listdir() if fn.endswith(‘.csv‘))
for fn in fns:
with open(fn, ‘rb+‘) as fp:
content = fp.read()
encoding = detect(content)[‘encoding‘]
content = content.decode(encoding).encode(‘utf8‘)
fp.seek(0)
fp.write(content)
批量改为utf-8编码
标签:coding ima water roc 分享图片 ges 技术 encode FN
原文地址:http://blog.51cto.com/13000661/2129573