An example:
>>> import numpy as np
>>> list = [1,2,3,4]
>>> array = np.asarray(list)
>>> np.shape(array)
(4,)
Now say I want to process a general array and read the number of rows and columns into variables m and n respectively, I would do:
>>> m, n = np.shape(array)
But this results in the error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: need more than 1 value to unpack
for the example above. In my example above I would have thought m=1 and n = 4 would instead have been an appropriate result. What am I missing?