So I have an input text file that looks like this:
0,0,0,0
0,0,1,0
0,1,0,0
0,1,1,1
1,0,0,0
1,0,1,0
1,1,0,1
1,1,1,1
I have successfully read all of these lines into a list which looks like this:
['0,0,0,0' , '0,0,1,0' , '0,1,0,0' , '0,1,1,1' , '1,0,0,0' , '1,0,1,0' , '1,1,0,1', '1,1,1,1']
My code for creating this list is
fileName = input("Filename:")
file = open(fileName,'r')
training = np.array(file.read().splitlines())
for i in range(len(training)):
a.append(training[i])
However I was wondering how I can turn the list into something that looks like this:
[ [0,0,0,0] , [0,0,1,0] , [0,1,0,0] , [0,1,1,1] , [1,0,0,0] , [1,0,1,0] , [1,1,0,1] , [1,1,1,1] ]
If it is not clear, my list has value of type string but I want the type to be in int as well as in the format above.
Please let me know if there is a way I can get this end result through changing my code or somehow doing some sort of conversion.