I have a list consisting of 4 digit strings (ie: list = ['0000', '1111', ...]) now I want to get a list of all possible 4 digit combinations (w/o rep) for each of these items
This is the code I have using permutations (of course it has repetitions but I will post this one since when I tried combinations it worked really bad)
permutes = defaultdict(list)
for item in funo_clean: ## funo_clean is the list with 4 digit numbers
for permutation in list(itertools.permutations(item)):
permutes[item].append("".join([str(x) for x in permutation]))
print ("\n")
Also, I don't want the list of combinations to contain the same number I am using to generate it (i.e: if I am using '8800' to generate it this number should not be in the list)
Thank you!
itertools.combinations
? – John Gordon