0

This is how my code is basically set up, but as you can see p1-p9 is static behavior. What if i dont know how many items will be unpacked from zip(*P)?

#What if i dont know how many items are being unpacked with *P?
for p_1, p_2, ... p_9 in zip(*P):
    #doing something with p1-pn

I wish to ask if there is a way to set up my iterator dynamically so that it depends on the state of zip(*P)

for p_array in zip(*P):
    #Maybe there is some way to set up a dynamic list as an iterator?

Hassan
  • 1
  • 1
    `p_1` is `p_array[0]`, `p_2` is `p_array[1]`, ... `p_n` is `p_array[n-1]`. I see the array (list) approach neater as it does not dirty the namespace with all these clearly-related variables of the form `p_X`. – Joe Iddon Oct 30 '19 at 17:14

1 Answers1

0

Found the answer

for p in zip(*P):
   print(list(p))
Hassan
  • 1