How to generate all permutations of a string?

bayerj bayerj at in.tum.de
Thu Jun 22 05:39:43 EDT 2006


Mind, that Lawrence's solution may contain doubles:

>>> [ i for i in permute("aa") ]
[('a', 'a'), ('a', 'a')]

If you don't want this, use sets.




More information about the Python-list mailing list