iex> num = [9]
'\t'
分配[9]的单个列表返回' \ t'。这是什么原因?
答案 0 :(得分:6)
您可以使用i helper in IEx获取有关数据类型的更多信息:
iex> i [9]
Term
'\t'
Data type
List
Description
This is a list of integers that is printed as a sequence of characters
delimited by single quotes because all the integers in it represent valid
ASCII characters. Conventionally, such lists of integers are referred to as
"char lists" (more precisely, a char list is a list of Unicode codepoints,
and ASCII is a subset of Unicode).
Raw representation
[9]
Reference modules
List
如果您想检查原始表示,可以将char_lists: false
传递给inspect
:
IO.inspect('abc', char_lists: false)
[97, 98, 99]