Answers for "find all unique substring permutations of a string of a specific length python"

0

find all unique substring permutations of a string of a specific length python

import itertools

x = "some string"

# aList contains all permutations of all lengths of string x
aList = [each for eachpermut in [''.join(l) for i in range(len(x)) for l in itertools.combinations(x, i+1)] for each in [''.join(eachpermut) for eachpermut in list(itertools.permutations(eachpermut))]]

# aSet only contains unique permutations of aList of varying lengths
aSet = set(aList))
Posted by: Guest on November-26-2020

Code answers related to "find all unique substring permutations of a string of a specific length python"

Python Answers by Framework

Browse Popular Code Answers by Language