grid = [] for i in range(int(rows)): row = [] for n in range(int(columns)): row.append(int(contents[n])) grid.append(row) print(grid)