标签:pre turn code import name odi pytho filename return
import chardet
def CheckCode(filename):
adchar=chardet.detect(filename)
if adchar[‘encoding‘]==‘utf-8‘:
filename=filename.decode(‘utf-8‘)
else:
filename=filename.decode(‘gbk‘)
return filename
标签:pre turn code import name odi pytho filename return
原文地址:http://www.cnblogs.com/tsw123/p/6027481.html