The number of lines is known at the very beginning.
Input file:
0 1 2 3 4 5 6 7 8 8 1 2 3 4 5 6 7 0 4 0 8 2 6 3 7 1 5 ..n such lines
Desired Result:
line1 = [0, 1, 2, 3, 4, 5, 6, 7, 8] line2 = [8, 1, 2, 3, 4, 5, 6, 7, 0] line3 = [4, 0, 8, 2, 6, 3, 7, 1, 5] . . linen = [n1, ........ n9]
I am now:
- Splitting the file '\ r \ n' on each line
- Getting each line using .split () before divide by spaces and convert int (i) to integers
The code:
python
Ketcomp
source share