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)格式的文件
最新推荐文章于 2024-09-13 14:39:26 发布