==错误原因:给append函数的参数太多,append只接收一个数据项==
错误代码:
Traceback (most recent call last):
File "<pyshell#67>", line 1, in <module>
case.append(1,2)
TypeError: append() takes exactly one argument (2 given)
==错误原因:remove、count字符串需要带上引号,不然会找不到==
错误代码:
Traceback (most recent call last):
File "<pyshell#55>", line 1, in <module>
case.remove(999)
ValueError: list.remove(x): x not in list
Traceback (most recent call last):
File "<pyshell#65>", line 1, in <module>
case.count(asd)
NameError: name 'asd' is not defined
==错误原因:sort、sorted不支持对嵌套列表进行排序==
错误代码:
Traceback (most recent call last):
File "<pyshell#77>", line 1, in <module>
case.sort()
TypeError: '<' not supported between instances of 'list' and 'str'
Traceback (most recent call last):
File "<pyshell#88>", line 1, in <module>
ca.sort()
TypeError: '<' not supported between instances of 'list' and 'int'
网友评论