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

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

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