这是我的代码的基本设置方式,但是正如您看到的p1-p9是静态行为。如果我不知道将从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
我想问一下是否有一种方法可以动态设置我的迭代器,使其取决于zip(* P)的状态
for p_array in zip(*P):
#Maybe there is some way to set up a dynamic list as an iterator?
找到答案
for p in zip(*P):
print(list(p))