Fix Object Has No Attribute Error in Python | Delft Stack
www.delftstack.com › howto › pythonDec 28, 2021 · However, this is not present with lists, so if we use this attribute with a list, we will get this AttributeError. See the code below. import numpy as np arr1 = np.array([8,4,3]) lst = [8,4,3] print(arr1.size) print(lst.size) Output: 3 AttributeError: 'list' object has no attribute 'size' The code above returns the size of the numpy array, but it doesn’t work with lists and returns the AttributeError. Here is another example with user-defined classes.