def perms(s):
    if len(s) == 1:
        return [s]
result = []
for i, v in enumerate(s):
    result += [(v + p) for p in perms(s[:i] + s[i + 1:])]
return result
perms('abc')
['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
print('\n'.join(perms('abc')))
abc
acb
bac
bca
cab
cba
All Permutations of a String in Python (Recursive)