[Solved] Print all possible combinations, given a specific number format [closed]


Try this:

with open('file.out', 'w') as output:
    for n in xrange(100000000):
        s = "{0:08d}".format(n)
        output.write(s[:2] + '-' + s[2:] + '\n')

… But be aware that that’s a lot of combinations, it’s possible that you’ll run out of memory, and if not anyway the resulting file will be huge and the program will take a lot of time to finish. Brute force is not a good idea here.

solved Print all possible combinations, given a specific number format [closed]