split list of tuples into two lists code example
Example 1: split list into list of lists python on every n element
big_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
x = 4
list_of_lists = [big_list[i:i+x] for i in range(0, len(big_list), x)]
# [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]
Example 2: python list of tuples to two lists
>>> zip(*[(1, 2), (3, 4), (5, 6)])
[(1, 3, 5), (2, 4, 6)]