def get_result_in_vector(vector, N, tmp, tmp_result):
"""
:param vector:所有组合的拼接
:param N:从几开始
:param tmp:
:param tmp_result: 空列表,暂时存储结果
:return:所有组合
获取所有组合结果
"""
for i in range(0, len(vector)):
if i < len(vector[N]):
tmp.append(vector[N][i])
if N < len(vector)-1:
get_result_in_vector(vector, N+1, tmp, tmp_result)
else:
one_result = []
for j in range(0, len(tmp)):
one_result.append(tmp[j])
tmp_result.append(one_result)
tmp.pop()
else:
continue
return tmp_result if __name__ == '__main__':
arr1 = [283, 284, 285, 286, 287]
arr2 = [288, 289, 290, 291, 292, 293]
arr3 = [294, 295]
arr4 = [296, 297]
arr5 = [298, 299, 300]
arr6 = [301, 302]
arr7 = [303, 304]
arr8 = [305, 306, 307, 308]
arr9 = [309, 310, 311, 312]
arr10 = [313, 314, 315, 316, 317]
result = []
vec_list = []
vec_list.append(arr1)
vec_list.append(arr2)
vec_list.append(arr3)
vec_list.append(arr4)
vec_list.append(arr5)
vec_list.append(arr6)
vec_list.append(arr7)
vec_list.append(arr8)
vec_list.append(arr9)
vec_list.append(arr10)
result_combine = get_result_in_vector(vec_list, 0, tmp_vec, result)
05-06 00:59