Python基础 检测多种语言编码 chardet
来源:互联网 发布:yum install chrome 编辑:程序博客网 时间:2024/05/21 17:12
检测语言
运行示例
#!/usr/bin/env python3# -*- coding: utf-8 -*-# Python基础 检测编码 chardetimport chardetresult = chardet.detect(b"Hello python")# {'encoding': 'ascii', 'confidence': 1.0, 'language': ''}# 1.0 表示正确率 100%print(result)chineseData = "万万没想到,我是王大锤".encode("gbk")result = chardet.detect(chineseData)# {'encoding': 'GB2312', 'confidence': 0.99, 'language': 'Chinese'}# 0.99 表示正确率 99%print(result)
运行结果
D:\PythonProject\sustudy>python main.py{'encoding': 'ascii', 'confidence': 1.0, 'language': ''}{'encoding': 'GB2312', 'confidence': 0.99, 'language': 'Chinese'}
chardet支持检测中文、日文、韩文等多种语言
阅读全文
0 0
- Python基础 检测多种语言编码 chardet
- Python字符编码检测 -- chardet
- python编码检测模块chardet
- python字符编码检测——chardet
- python chardet模块 检测文档编码
- Python使用chardet检测字符编码
- Python之动态检测编码chardet
- Python编码检测 chardet 效果不如 UnicodeDammit
- 01-chardet编码检测
- Python | 多种编码文件(中文)乱码问题解决 chardet模块
- 17.python字符编码检测——chardet
- 如何用Python中的chardet去检测字符编码类型
- Python之检测文件的字符编码(chardet)
- Python chardet 字符编码判断
- python-字符编码库chardet
- Python chardet 字符编码判断
- python chardet模块查看编码
- [python3.x] 利用chardet检测网页编码
- Meteor + React 学习文档汇总
- ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
- Spring boot 应用maven 打包 遇到的情况
- git: 添加表情包 提升 github仓库 逼格
- js中的闭包
- Python基础 检测多种语言编码 chardet
- VLC多线程
- C++类型转换
- iOS 实现3Dtouch
- System.IO.Directory.Delete 方法的使用
- postgresql ltree
- 【数据结构课设】校园导游系统
- MySQL函数
- linux实时查看更新日志命令