【发布时间】:2016-05-01 13:06:18
【问题描述】:
我有一个文本文件。它由许多非英文字符组成。我想将此文件存储为数字序列,例如 ascii。
如何表示非英文字符?
>>> str(ord('x'))
'120'
>>> str(ord('ç'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: ord() expected a character, but string of length 2 found
>>>
【问题讨论】:
-
为什么要将其存储为数字序列?
-
为机器学习技术创建数据集。
标签: python encoding character-encoding python-2.x