I have a file in which I have some lines that looks like this:
[16, 1, 4, 15][0, 4, 5, 14][8, 9, 10, 3][2, 11, 12, 6][0, 1, 10, 11][1, 19, 12, 14][19, 3, 13, 15][9, 17, 14, 15][9, 2, 18, 17][8, 2, 13, 7][4, 2, 19, 12][16, 18, 3, 4][10, 3, 5, 15][16, 9, 18, 6][1, 19, 5, 7][0, 12, 6, 7][0, 17, 11, 13][16, 8, 18, 7][8, 17, 11, 13][10, 6, 5, 14]
and I want to read them, and make a list of lists with each line.
I've tried split()
function but does not work.
What I've tried is:
file = open(filename, 'r')
string.split(',')
print(string[3])
But it returns ,
, not [2, 11, 12, 6]
Any guesses? Thanks in advance!