如何在一个列表中迭代n次

问题描述 投票:0回答:1

我想执行这样的操作:

rules = [
for i in somethings : {
//actions
},
for s in others : {
//actions
}
]

我需要获得一个结果列表,其中包含几个迭代循环的结果。我认为的扁平逻辑。

terraform
1个回答
1
投票

确实需要压扁

rules = flatten([[
for i in somethings : {
//actions
}],
[for s in others : {
//actions
}
],])
© www.soinside.com 2019 - 2024. All rights reserved.