Одним из способов может быть создание master-list
и затем транспонирование:
def func():
return np.random.randint(0, 10), np.random.randint(10, 20)
masterLst = []
for i in range(5):
masterLst.append(func())
l1,l2 = zip(*masterLst)
print(list(l1))
print(list(l2))
ВЫХОД :
[6, 5, 8, 6, 2]
[19, 11, 19, 10, 17]
РЕДАКТИРОВАНИЕ :
Исходя из @hpaulj, вариант текущего подхода:
def func():
return np.random.randint(0, 10), np.random.randint(10, 20)
l1,l2 = list(zip(*[func() for _ in range(4)]))
print(list(l1))
print(list(l2))