Help for this page
from itertools import product ... words = inputstring.split() for combo in product(' -', repeat=len(words) - 1): yield ''.join(w for pair in zip(words, combo + ('',)) for w in + pair)
'convert perl-to python' 'convert-perl to python' 'convert perl-to-python' 'convert-perl-to python' 'convert-perl-to-python'