Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'list' object is not callable

刚开始学习python的时候,可能会由于命名的不注意,导致也方法一直用不了,原因是在声明变量对的时候和python内置方法冲突了,导致方法被重新定义了,这样一来,方法自然也就不存在了

 

解决办法:先复制个其他的list

c = list.copy()

然后清空list列表名的列表

list.clear()

再次使用list( ),成功声明并赋值

l1 = list(range(10))

 

相关文章:

  • 2022-12-23
  • 2021-08-06
  • 2021-12-08
  • 2021-09-05
  • 2021-10-15
  • 2021-12-16
  • 2021-11-29
猜你喜欢
  • 2022-12-23
  • 2021-06-18
  • 2021-09-15
  • 2022-12-23
  • 2021-12-24
相关资源
相似解决方案