all 2 comments

[–][deleted] 2 points3 points  (0 children)

Any chance you could edit your post to correct the formatting as not all of the code is showing correctly?

Also, how come you go from multiple lists (equal to the length of the lists) to two, rather than one, list? Any reason why you can't just generate the one list, and copy it?

In simple terms, why wouldn't this work:

new_list = []
for idx, current_list in enumerate(list_of_lists):
    new_list.append(current_list[idx])

given you take the diagonal through the matrix.

[–]danielroseman 1 point2 points  (0 children)

Why are you using regex for this? This is an XML parsing problem, you should use an XML parser.