0

How to read matrix input into a 2-D list in python 3?

I am trying to input a 3X3 matrix in 2D list input format is 1 2 3 4 5 6 7 8 9

20th Jun 2017, 6:09 AM
Dhruva Ahuja
Dhruva Ahuja - avatar
1 Resposta
+ 2
If you're reading from a file: arraylist = [] for line in file: innerlist = [] for number in line.split(): innerlist.append(int(number)) arraylist.append(innerlist)
20th Jun 2017, 7:23 AM
Bogdan Sass
Bogdan Sass - avatar