def all_permutations_substrings(a_str):
    return (''.join(item) for length in range(1, len(a_str) + 1) for item in
        itertools.permutations(a_str, length))
Python permutations including substrings