This will go through and create every possible permutation of a username with a length of between 4 and 255 characters.
import itertools # creating file f = open('usernames.txt', 'w') # setting character possibilities chrs = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' # setting lengths min_length, max_length = 4, 255 # generate every possible combination for n in range(min_length, max_length+1): for xs in itertools.product(chrs, repeat=n): print(''.join(xs))
I am trying to calculate the amount of characters so that I can estimate disk space used. This is my code to count each character. I am looping through each amount of iterations and multiplying it by the number in the range. Can you please double check to make sure that I am correctly looping so that my count is correct?
parent = 62 # setting lengths min_length, max_length = 4, 255 iterations =  character_count =  # generate every possible combination for i in range(min_length, max_length+1): iteration = parent ** i iterations.append(iteration) for c in iterations: for i in range(min_length, max_length+1): characters = c * i character_count.append(characters) print(sum(character_count))
I'm not a mathematician, so I'm just hoping I do it right.