I need to read a file containing information on different lines - for example the file may contain
12345678910
abcdefghij
zyxwvutsrq
I will then need to read the code diagonally so my list would be:
(1bx)(2cw)(3dv)
I have tried using zip and just can't figure out a way to get it to work.
EDIT
Is there anyway to also make it take into account the diagonals before the top left corner for example:
(ay)(z)
in the example file I used.
Edit 2: this is my almost complete code
with open(FileName) as diagonal :
a = diagonal.read().splitlines()
l = [a[i][i:] for i in range(len(a))]
Diaglist = [''.join(i) for i in zip(*l)]
with open(FileName) as diagonal1 :
b = diagonal1.read().splitlines()
o = [b[i][:i] for i in range(len(b))]
Diaglist1 = [''.join(i) for i in zip(*o)]
When I run the file I get the correct diagonals for the first with so from the top right to left but the second with so from the top right downwards I just get an empty list.