zl程序教程

您现在的位置是:首页 >  后端

当前栏目

成功解决AttributeError: 'list' object has no attribute 'shape'

List 解决 成功 No object has attribute AttributeError
2023-09-14 09:04:51 时间

成功解决AttributeError: 'list' object has no attribute 'shape'

 

 

目录

解决问题

解决思路

解决方法


 

 

 

 

 

 

 

解决问题

AttributeError: 'list' object has no attribute 'shape'

 

解决思路

属性错误:“list”对象没有属性“shape”

 

解决方法

经常使用numpy库的会知道,np.array可使用 shape。而对于列表list,却不能使用shape来查看列表的维度。如果非要想查看列表维度,可以采用:

T1、将列表转为array格式,然后使用shape即可!
list_shape = np.array(list_01).shape
print(list_shape)