解决python使用list()时总是报错的问题
作者:进阶丶xiao路 时间:2021-11-27 23:34:36
如下所示:
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))
补充知识:python多维数组输出去除中括号
来源:https://www.cnblogs.com/yaradish/p/10503425.html
标签:python,list,报错
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python pyecharts案例超市4年数据可视化分析
2021-04-09 21:10:29
![](https://img.aspxhome.com/file/2023/3/77643_0s.gif)
python邮件中附加文字、html、图片、附件实现方法
2022-10-28 01:17:13
高效率的GetRows()的使用方法
2008-09-23 18:29:00
![](https://img.aspxhome.com/file/UploadPic/20089/23/access-table_39s.jpg)
Python利用cv2动态绘制圆和矩形的示例详解
2022-08-20 08:23:15
对Python中内置异常层次结构详解
2023-10-18 11:08:49
网马解密大讲堂——网马解密中级篇(Freshow工具使用方法)
2009-09-16 15:09:00
![](https://img.aspxhome.com/file/UploadPic/20099/16/freshow-13s.jpg)
python的列表List求均值和中位数实例
2023-07-09 13:06:16
python实现移位加密和解密
2022-03-20 09:09:27
![](https://img.aspxhome.com/file/2023/6/105726_0s.jpg)
关于PyQt5中QtGui.QImage图片显示问题解析
2022-05-17 19:59:12
![](https://img.aspxhome.com/file/2023/4/111884_0s.png)
轻松解决SQL Server 2005中的常见问题
2008-11-28 14:11:00
pandas按条件筛选数据的实现
2021-10-04 03:07:54
![](https://img.aspxhome.com/file/2023/4/105564_0s.png)
对python-3-print重定向输出的几种方法总结
2023-10-21 19:38:58
利用Axure封装视觉标准
2008-10-21 10:42:00
![](https://img.aspxhome.com/file/UploadPic/200810/21/20081021104738239s.jpg)
Pytorch数据拼接与拆分操作实现图解
2021-08-01 04:37:05
![](https://img.aspxhome.com/file/2023/3/95453_0s.png)
Python tkinter库绘制春联和福字的示例详解
2022-03-05 06:29:04
![](https://img.aspxhome.com/file/2023/0/95930_0s.png)
利用Pycharm + Django搭建一个简单Python Web项目的步骤
2021-10-21 15:35:47
![](https://img.aspxhome.com/file/2023/2/88922_0s.jpg)
python实现可视化动态CPU性能监控
2023-08-08 10:23:52
![](https://img.aspxhome.com/file/2023/5/62005_0s.jpg)
浅谈Python实现Apriori算法介绍
2021-09-14 19:10:22
![](https://img.aspxhome.com/file/2023/9/115729_0s.png)
python数据清洗系列之字符串处理详解
2023-08-02 04:00:07
![](https://img.aspxhome.com/file/2023/0/113060_0s.png)
对Server.UrlEncode进行字符反编译
2009-06-22 12:54:00