<分区>
我正在学习 Python,并且正在学习 Dive into the Python 这本书。它说:
The built−in
range
function returns a list of integers. In its simplest form, it takes an upper limit and returns a zero−based list counting up to but not including the upper limit.
根据它所说的,它返回一个列表。我以为我可以使用 append 函数为其附加一个值,但我做不到。
>>> l = range(7)
>>> l
[0, 1, 2, 3, 4, 5, 6]
>>> l.append(13)
>>> l
[0, 1, 2, 3, 4, 5, 6, 13]
>>> l = range(7).append(13)
>>> l
什么都不打印,是什么原因?