from numpy import *
f = open('matrix.txt', 'r')
x = []
for line in f.readlines():
y = [value for value in line.split()]
x.append(y)
f.close()
x = map(int, x)
a = array([x])
Basically, my code is suppose to open the text file and put it into the list x. I then change those values in x into an integer and place that in an array a. Is there a faster way to do this? Btw my code doesn't work.