I need to read data from a file that's formatted like this:
0.00000 62.12404 0.00000
1.95695 62.12288 0.00000
3.91389 62.11939 0.00000
5.87084 62.11357 0.00000
7.82779 62.10543 0.00000
9.78474 62.09496 0.00000
11.74168 62.08218 0.00000
13.69863 62.06707 0.00000
(the script that produces the data specifies the format as "%9.5f").The number of lines isn't fixed and I want to have either an 3xN array or 3 arrays of length N at the end. Normally i'd use lines.split but that doesn't really work if the number of spaces between the numbers isn't fixed.
' 23 545 345 '.split()returns['23', '545', '345']split()like this:array = np.zeros((len(lines),3)) for i in range (len(lines)): array[i,:]=(lines[i].split())I just get ValueError: cannot copy sequence with size 0 to array axis with dimension 3