tags:

views:

73

answers:

1

i want all combinations words of string "my first program"

+5  A: 
>>> lst = "my first program".split()
>>> set(itertools.permutations(lst))

set([('first', 'my', 'program'),
     ('first', 'program', 'my'),
     ('my', 'first', 'program'),
     ('my', 'program', 'first'),
     ('program', 'first', 'my'),
     ('program', 'my', 'first')])
killown