I have a text file like this:
0 0 1
1 1 1
1 0 1
0 1 0
And i would like to get a 2D array like this:
[[0,0,1],
[1,1,1],
[1,0,1],
[0,1,0]]
I have tried:
with open("Input_Data.txt", "r") as txt_file:
input_data = [line.split() for line in txt_file]
print(input_data)
But it returns:
[['0', '0', '1'], ['1', '1', '1'], ['1', '0', '1'], ['0', '1', '0']]
How could I get an array of int instead of string please?