I have some lines in a file that look like this:
0 3 0
0 5 0
1 0 1
I want to store it in a list, like [0 3 0 0 5 0 1 0 1]
Currently I have:
for i in range(0, 3):
-> mytmp = lines.split()
-> for j in range(0, 3):
-> -> myList.append(float(mytmp[j])
Is there a way to condense this to one line? I know myList = [next(filename) for i in range(0, 3)] will do the beginning part of the code, but is there a way to split things as well and then store those elements all in one line? Thanks!