combinations - Python get all permutations of numbers -


i'm trying display possible permutations of list of numbers, example if have 334 want get:

3 3 4 3 4 3 4 3 3 

i need able set of digits 12 digits long.

i'm sure simple using itertools.combinations can't quite syntax right.

tia sam

>>> lst = [3, 3, 4] >>> import itertools >>> set(itertools.permutations(lst)) {(3, 4, 3), (3, 3, 4), (4, 3, 3)} 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -