python读写UCS-2 big/little endian(utf-16-be/utf-16-le)格式的文件
来源:互联网 发布:深度linux deepin安装 编辑:程序博客网 时间:2024/05/18 03:17
def readFile(path):
oFile = file(path, 'r')
line = ""
line = oFile.readline()
encoding = None
lst = []
if line.startswith('/xFF/xFE'):
encoding = 'utf-16-le'
oFile.close()
import codecs
oFile = codecs.open(path, 'r', encoding)
lst = oFile.readlines()
oFile.stream.close()
- python读写UCS-2 big/little endian(utf-16-be/utf-16-le)格式的文件
- 彻底搞懂字符编码(unicode,mbcs,utf-8,utf-16,utf-32,big endian,little endian...)
- 彻底搞懂字符编码(unicode,mbcs,utf-8,utf-16,utf-32,big endian,little endian...)
- 彻底搞懂字符编码(unicode,mbcs,utf-8,utf-16,utf-32,big endian,little endian...)
- 彻底搞懂字符编码(unicode,mbcs,utf-8,utf-16,utf-32,big endian,little endian...)
- 彻底搞懂字符编码(unicode,mbcs,utf-8,utf-16,utf-32,big endian,little endian...)
- 彻底搞懂字符编码(unicode,mbcs,utf-8,utf-16,utf-32,big endian,little endian...)
- 彻底搞懂字符编码(unicode,mbcs,utf-8,utf-16,utf-32,big endian,little endian...)
- 彻底搞懂字符编码(unicode,mbcs,utf-8,utf-16,utf-32,big endian,little endian...)
- 彻底搞懂字符编码(unicode,mbcs,utf-8,utf-16,utf-32,big endian,little endian...)
- 彻底搞懂字符编码(unicode,mbcs,utf-8,utf-16,utf-32,big endian,little endian...)
- 彻底搞懂字符编码(unicode,mbcs,utf-8,utf-16,utf-32,big endian,little endian...)
- 彻底搞懂字符编码(unicode,mbcs,utf-8,utf-16,utf-32,big endian,little endian...)
- unicode的UTF-16BE和UTF-16LE
- UTF-8,UTF-16,UNICODE,UNINCODE BIG ENDIAN的关系
- VC_字体编码格式_ASCII、Unicode、UTF-8、UTF-16、UCS、BOM、Endian
- [Charset]UTF-8, UTF-16, UTF-16LE, UTF-16BE的区别
- [Charset]UTF-8, UTF-16, UTF-16LE, UTF-16BE的区别
- 数据库并发操作的一致性问题
- PHP分页代码 PHP分页类 PHP分页实例
- ORACLE物化视图--物化视图日志没有清除问题、日志清除方法
- Use Case 中 include 与 extend 的区别
- microwindows简单小程序
- python读写UCS-2 big/little endian(utf-16-be/utf-16-le)格式的文件
- 游标 触发器 笔记
- DWR实例教程
- 反射+代理+框架=我的迷你型框架
- test by Writer
- 使用json
- 方法上的通用准则
- 网站页面静态化方案
- MFC(win32GUI)程序中显示Dos调试信息.console.显示控制台界面.标准输出.