Python creating a list with itertools.product?

前端 未结 3 1282
有刺的猬
有刺的猬 2021-02-20 04:40

I\'m creating a list with itertools from a list of ranges, so far I have this:

start_list = [xrange(0,201,1),xrange(0,201,2),xrange(0,201,5),xrange(0,201,10),xra         


        
3条回答
  •  北海茫月
    2021-02-20 05:16

    Use this:

    next_list = list(item for item in itertools.product(*start_list) if sum(item) == 200)

提交回复
热议问题