如何使用Python查看编码格式
import chardet
f = open ( ‘file’ , ‘r’ )
fencoding = chardet.detect(f.read())
print fencoding
其中,file代表跟代码相同文件夹的文件名称。
fencoding的打印结果代表文件的编码格式。
如何使用Python查看编码格式
import chardet
f = open ( ‘file’ , ‘r’ )
fencoding = chardet.detect(f.read())
print fencoding
其中,file代表跟代码相同文件夹的文件名称。
fencoding的打印结果代表文件的编码格式。