Home > other >  How to use the permutation and combination and then create a list or dictionary
How to use the permutation and combination and then create a list or dictionary

Time:09-17

As title, hopes to the 10 number from 1 to 10, choose number 3, have repeated the permutation and combination of
Get a dictionary or a list of forms, such as hidden_layer_sizes=[,1,1 (1), (1, 2, 1)... The
I use the list (itertools. The product (" 123456789 ", repeat=3)), get the form such as [(' 1 ', '2', '3') and (' 1 ', '2', '1')] this
Later can't use

CodePudding user response:

Didn't understand what you mean

CodePudding user response:

 
The import itertools

Aaa=list (itertools. The product (" 1234 ", repeat=3))
Lista=[]
For aa in aaa:
Lista. Append ([int (a1) for a1 in the list (aa)])
Print (lista)


Transformation of the

CodePudding user response:

Is a string list, you send out the arrangement is a string, want to digital, then digital transfer list,
 

Aaa=list (itertools. Product (range (1, 11), repeat=3))

  • Related