I have something like this table:
table =
[[set(), {A}, set(), {B}],
[{c}, set(), set(), {D}]]
I want to iterate through the columns so that in order I'm looking at B, D, set(), set(), A, set(), set(), C
I flipped my table using zip(*table) and now this:
table = zip(*table)
for word_index, row in enumerate(table):
for index in range(len(row)):
print(row[index])
allows me to iterate like set(), C, A, set(), set(), set(), B, D
Which is very close. But I want to also reverse.
zip(*table) does not allow me to call reversed(zip(*table))
How can I iterate through how I want? I don't really want to import Pandas or numpy if I can avoid it.
question from:
https://stackoverflow.com/questions/65941891/how-can-i-iterate-through-this-zipped-table-backwards 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…