'tuple' object is not callable解决方案
来源:互联网 发布:淘宝淘口令有没有权重 编辑:程序博客网 时间:2024/06/06 01:19
在按照书上的代码操作的时候,有些时候会遇到一些很奇怪的bug,标题就是一个这样的bug。
操作实例的时候是用了shape函数
为了解决这个bug,查了很多资料,都没有找到解决方案,最后不断尝试,并结合了一点经验解决了。 解决之后发现问题也特别简单
有bug的代码如下:
from numpy import *a = array([[1, 3], [2, 4], [5, 6]])print(a.shape(0))
要是能找到错误,就非常好了
其实错误很简单
正确的代码如下
from numpy import *a = array([[1, 3], [2, 4], [5, 6]])print(a.shape[0])
其实这个bug应该很容易发现才对,但是,最近打了很多matlab的文件()符号在MATLAB中就是[]的类似意思,所以找了很久。
分享给大家,供大家一起学习 觉得有点帮助就点个赞吧
**
最后,老套路,宣传一波自己的公众号!(求关注哇!)
本人中大一肥宅,欢迎大家关注,请扫下面的二维码(〃’▽’〃)
阅读全文
1 0
- 'tuple' object is not callable解决方案
- TypeError: 'tuple' object is not callable
- str' object is not callable
- 'dict' object is not callable
- 'module' object is not callable
- TypeError: 'str' object is not callable
- TypeError: 'sip.methoddescriptor' object is not callable
- TypeError: 'str' object is not callable
- TypeError: 'module' object is not callable
- TypeError: 'str' object is not callable
- 【Python】Error:'int' object is not callable
- TypeError: 'str' object is not callable
- TypeError:'dict' object is not callable
- TypeError: 'str' object is not callable
- [Python] 'unicode' object is not callable
- TypeError: 'str' object is not callable
- Django错误'str' object is not callable
- TypeError: 'str' object is not callable
- 前端代码合集
- $('#address').combotree({ url:common.getContextPath()+'/base/getWtsdTree.do', lines:true,
- HTML ionic左和右的侧滑栏
- 基于Vue、Nodejs、Socket.io的聊天应用
- java下载远程FTP文件至本地
- 'tuple' object is not callable解决方案
- PullToRefresh实现ListView的刷新,加载更多的展示
- 2006年培养学员8万人,每年增长%25,请问按此增长速度,到那一年培训学员人数将达到20万人用for,while,dowhile,实现
- 2006年培养学员8万人,每年增长%25,请问按此增长速度,到那一年培训学员人数将达到20万人用for,while,dowhile,实现
- 垃圾回收机制
- 拷贝构造中的N中调用情况
- linux路由管理方法汇总
- 手写一个JSONP
- 管理网络