What I was suggesting is this:
import csv with open('numbers.csv', newline='') as csvfile: puzzle=csv.reader(csvfile, delimiter=' ', quotechar='|') # Read all the rows so you get # matrix = [[0, 0, 9, 0, 0, 0, 5, 6, 2], [0, 0, 0, 9, 0, 0, 0, 0, 0], ...] matrix = [row for row in puzzle] # If now you want to print the matrix for row in matrix: print(', '.join(row)) # Or transform it to integer matrix and not just strings... assuming all the elements are integers. matrix =[[int(s) for s in row] for row in matrix]About using eval... avoid it as much as you can. It is useful and powerful, specially when you are a noob but almost anything you can do with eval you can do it better in another way without the risk of explosion (not to mention the huge security problem)