Skip to content

python运维

python运维

  • 首页

python运维

python运维

  • 首页
2023年 3月 17日

如何使用Python查看编码格式

  • 未分类
  • admin

如何使用Python查看编码格式
import chardet
f = open ( ‘file’ , ‘r’ )
fencoding = chardet.detect(f.read())
print fencoding

其中,file代表跟代码相同文件夹的文件名称。
fencoding的打印结果代表文件的编码格式。

Copyright © 2022