I'm trying to read a text file with matrix and put it in a list, but I am using two loops here and I want my function to be faster.
def read_file(path_to_file):
mylist=[]
for eachLine in open(path_to_file,'rt'):
mylist.append([int(eachRow) for eachRow in eachLine.split()])
return mylist
int
can handle only one number at a time, you have to have 2 loops of some sort. \$\endgroup\$