Suppose you have input file like this(triangle.txt) to use as input …
with open('triangle.txt') as f: D = [[int(w) for w in line.split()] for line in f]
This will create a nice table-like 2-D list, i.e. a list of lists. The member list(s) can be of variable size. You can modify the int(w) for w in line.split() part to incorporate your processing.
My dumb code(yet, right) was:
f=open("triangle.txt") A= for i in range(100): A.append((f.readline()).strip()) // processing D= for i in range(100): D.append((A[i]).split()) for i in range(100): for j in range(len(D[i])): D[i][j]= int(D[i][j])