DISCO
DISCO

Reputation: 357

How to iterate n times in one list

I want to perform something like this:

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

I need to get in result one list with the result of few iterated loops. The flatten logic I think.

Upvotes: 0

Views: 336

Answers (1)

DISCO
DISCO

Reputation: 357

It really needs flatten

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

Upvotes: 1

Related Questions