Try something like that:

```
In [53]: l = [0,1,2,3]
In [54]: def to_matrix(l, n):
...: return [l[i:i+n] for i in xrange(0, len(l), n)]
In [55]: to_matrix(l,2)
Out[55]: [[0, 1], [2, 3]]
```

### Related Contents:

- Transpose/Unzip Function (inverse of zip)?
- Difference between numpy.array shape (R, 1) and (R,)
- What are the differences between numpy arrays and matrices? Which one should I use?
- Very large matrices using Python and NumPy
- numpy matrix vector multiplication [duplicate]
- Get all the diagonals in a matrix/list of lists in Python
- Numpy matrix to array
- Pretty print 2D list?
- Bin elements per row – Vectorized 2D Bincount for NumPy
- Convolve2d just by using Numpy
- Sum of list of lists; returns sum list
- Determining neighbours of cell two dimensional list
- Numpy ‘smart’ symmetric matrix
- Convert a 1D array to a 2D array in numpy
- How to get element-wise matrix multiplication (Hadamard product) in numpy?
- how does multiplication differ for NumPy Matrix vs Array classes?
- How can I plot a confusion matrix? [duplicate]
- numpy get index where value is true
- How to input matrix (2D list) in Python?
- Why does numpy.linalg.solve() offer more precise matrix inversions than numpy.linalg.inv()?
- Efficiently Calculating a Euclidean Distance Matrix Using Numpy
- Deprecation status of the NumPy matrix class
- How do I calculate a word-word co-occurrence matrix with sklearn?
- NumPy array/matrix of mixed types
- Iterating over Numpy matrix rows to apply a function each?
- how to perform max/mean pooling on a 2d array using numpy
- Co-occurrence matrix from nested list of words
- Finding neighbor cells in a grid with the same value. Ideas how to improve this function?
- Is there a standard solution for Gauss elimination in Python?
- How do I check if a list is empty?
- JSONDecodeError: Expecting value: line 1 column 1 (char 0)
- pandas: filter rows of DataFrame with operator chaining
- How to execute Python scripts in Windows?
- Plotting with seaborn using the matplotlib object-oriented interface
- How do you create nested dict in Python?
- Difference between except: and except Exception as e:
- Numpy – create matrix with rows of vector
- The smtplib.server.sendmail function in python raises UnicodeEncodeError: ‘ascii’ codec can’t encode character
- Classification using movie review corpus in NLTK/Python
- Multiple ping script in Python
- Storing RTSP stream as video file with OpenCV VideoWriter
- How to set selenium webdriver from headless mode to normal mode within the same session?
- How to create module-wide variables in Python? [duplicate]
- Check if string has date, any format
- How can I limit the user input to only integers in Python
- Matplotlib issue on OS X (“ImportError: cannot import name _thread”)
- Order of Serializer Validation in Django REST Framework
- Chromedriver, Selenium – Automate downloads
- How to copy directory recursively in python and overwrite all?
- How to know the encoding of a file in Python? [duplicate]