I'm using the itertools.permutations
function to create a list of all combinations of characters in a list, then joining the results together, like this:
from itertools import permutations
def iterate(it):
for x in it:
print("".join(list(x)))
k_c = "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM. "
iterate(permutations(list(k_c),10))
This is what it produces:
>>>1234567890
123456789q
123456789w
123456789e
123456789r
123456789t
123456789y
123456789u
123456789i
123456789o
...
The problem that I have is this; I need to create strings like this that are 100 characters long, such as: 1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDJ1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDJ
and the program will stall, as it takes too long t runiterate(permutations(list(k_c),100))
I was wondering if it would be possible for the program to just return a specific string, like this:
permutation_string(k_c,100,87)
>>> 1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDJ1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDJ
And it would return the 87th value within the list. I realise this seems like a strange question, but any help would be appreciated. Thanks