'NoneType' object has no attribute 'shape'
时间: 2023-10-10 19:14:27 浏览: 149
python报错: 'list' object has no attribute 'shape'的解决
5星 · 资源好评率100%
This error message is typically encountered in Python when trying to access the shape attribute of a variable that has no value assigned or has a value of None.
For example, if you have a variable named "my_array" that should contain a numpy array but is instead set to None, and you try to access its shape attribute using "my_array.shape", you will get this error message.
To avoid this error, you should make sure that any variable you are accessing the shape attribute of has a value assigned and is not None. You can use conditional statements or try-except blocks to handle cases where the variable might be None.
阅读全文