jeudi 18 août 2022

I have a python script that generates both letters and numbers combinations of a certain length that can be selected in the settings

I need to make sure that the first character does not change and the others change, help me with this

from random import randrange
from multiprocessing import Process, cpu_count, Value
###################################################################
alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
cores = cpu_count()
###################################################################
def gen(l):
    return ''.join([alphabet[randrange(0, len(alphabet))] for i in
                    range(l)])
res = open('result.txt', 'a')

def work():
    while True:
            res.write('{0}\n'.format(gen(18)))  
###################################################################
if __name__ == '__main__':
    workers = []
    for r in range(cores):
        p = Process(target=work)
        workers.append(p)
        p.start()
    for worker in workers: worker.join()
    res.close()
###################################################################



Aucun commentaire:

Enregistrer un commentaire