English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
1实测,这个版本在32for window7and python3.2environment and use them normally.
2Usage: Copy the chardet and docs folders extracted to the python3.2The Lib\site directory-The packages directory can be used normally.
3The reference code for judging the file encoding is as follows:
file = open(fileName, "rb")#The "rb" is required, if not, the default uses gbk to read the file. buf = file.read() result = chardet.detect(buf) file = open(fileName,"r",encoding=result["encoding"]) content = file.readlines()
This article on 'chardet (example explanation) in file encoding judgment in python' is all the content shared by the editor. I hope it can be a reference for everyone, and I also hope everyone will support the呐喊 tutorial more.
Declaration: The content of this article is from the Internet, owned by the original author. The content is contributed and uploaded by Internet users spontaneously. This website does not own the copyright, does not edit the content manually, and does not assume relevant legal liability. If you find any content suspected of copyright infringement, please send an email to: notice#oldtoolbag.com (When reporting, please replace # with @) for reporting violations, and provide relevant evidence. Once verified, this site will immediately delete the content suspected of infringement.