I have the following Python script portion:
X_to_text_file = np.savetxt('x.txt', X.reshape(np.shape(X)), fmt='%5f')
for which I'm getting this error:
AttributeError: 'list' object has no attribute 'reshape'
Provided that X
is a Numpy
array, which I obtained as follows:
for img in range(len(names)):
for name in names:
img = np.array(Image.open(name))
X.append(img)
Any ideas why I'm getting this error and how I can solve it?
Thanks.