i have a text file like this
.txt
1, 2, 3, 4, 5, 6, 7, 8, 9
and i would like to view this as an array in python this is what i have so far
python file
file_board = open('index.txt')
board = file_board.read().split(',')
print board
print len(board)
output
['[[1', ' 2', ' 3]', ' [4', ' 5', ' 6]', ' [7', ' 8', ' 9]]\n']
9
list index out of range
so what i want todo is some how make this in to a 2D array for manipulation
Note I would like to do this without any external libraries, build in libraries are fine
by the way i would like to write this back to a new file in the format of
1, 2, 3, 4, 5, 6, 7, 8, 9