有没有理由`tolist()`不能在列表上运行?

时间:2017-09-22 10:17:14

标签: python-2.7

我经常认为,即使原始对象是一个列表,也可以进行以下工作......是否有理由没有实现此功能(在python 2.7中)?

示例:

>>> a = [1,2,3,4]
>>> a.tolist()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'list' object has no attribute 'tolist'

0 个答案:

没有答案