I am currently trying to re-sort a list I got from parsing a website.
I have tried everything but I don't think I found the best solution to my problem.
Let's say we have the following list:
my_list = [['a', 'b', 'c'], ['a', 'b', 'c']]
What I am trying to convert it to:
new_list = [['a', 'a'], ['b', 'b'], ['c', 'c']]
I came up with the following loop:
result = [[], [], []]
for sublist in my_list:
for i in range(0, len(sublist)):
result[i].append(sublist[i])
print(result)
# output: [['a', 'a'], ['b', 'b'], ['c', 'c']]
My method is not the best I assume and I am searching for the most pythonic way to do it if you know what I'm saying.