I would like to read a data from file to double nested lists. How can I do it in Python 3? I know that if I know the dimensions beforehand, I can write
# Creates a list containing 5 lists, each of 8 items, all set to 0
w, h = 8, 5;
Matrix = [[0 for x in range(w)] for y in range(h)]
like in How to define a two-dimensional array in Python . But in my situation I read data from file and I don't know beforehand how much data there is. So the idea is to increase the matrix size while reading, like first
1 2 3
then
1 2 3
2 3 4
then
1 2 3
2 3 4
3 4 5
and so on.