import numpy new_list = [i for i in range(9)] numpy.array(new_list).reshape(3,3)
With the help of the numpy library;