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

原因:list对象没有属性shape
解决方法:
numpy库中np.array可使用 shape
对于列表list,不能使用shape来查看列表的维度。
如果非要想查看列表维度,可以将列表转为array格式,然后使用shape即可。

# list_0为需要查看shape的list
list_shape = np.array(list_0).shape
print(list_shape)

你可能感兴趣的:(Python,Python常见报错,numpy,python)