from?https://blog.csdn.net/sinat_24648637/article/details/84190482
1. chardet模塊
舉例
2. Supported encoding for python
1. chardet模塊
The easiest way to use the Universal Encoding Detector library is with the detect function.
使用通用編碼檢測(cè)器庫的最簡單方法是使用detect函數(shù)
The detect function takes one argument, a non-Unicode string. It returns a dictionary containing the auto-detected character encoding and a confidence level from 0 to 1.
detect函數(shù)有一個(gè)參數(shù), 即非 unicode 字符串。它返回一個(gè)字典, 其中包含自動(dòng)檢測(cè)的字符編碼和從0到1的置信度。
舉例
>>> import chardet
>>> chardet.detect('abc123')
{'confidence': 1.0, 'encoding': 'ascii'}
>>> chardet.detect('中國')
{'confidence': 0.7525, 'encoding': 'utf-8'}
1
2
3
4
5
2. Supported encoding for python
截圖來自https://chardet.readthedocs.io/en/latest/usage.html#example-using-the-detect-function
---------------------
作者:blank4569
來源:CSDN
原文:https://blog.csdn.net/sinat_24648637/article/details/84190482
版權(quán)聲明:本文為博主原創(chuàng)文章,轉(zhuǎn)載請(qǐng)附上博文鏈接!
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元
