I think you should use numpy, which is designed to work with matrices / arrays, not a list of lists. It will look like this:
>>> import numpy as np
>>> list_ = [0,1,2,3]
>>> a = np.array(list_).reshape(2,2)
>>> a
array([[0, 1],
[2, 3]])
>>> a.shape
(2, 2)
Avoid calling a variable listas it obscures the built-in name.
source
share