jeudi 28 décembre 2017

Random string generated with random spacing in between

I would like to create a pattern the contains uppercase letters and numbers, also random spacing in between as OI00 XKB or IT IEEW 88 ... etc

I have started with this code it generate random code but the spacing is constant between as {}{}{}{} {}{}{}

code

def codeGen():
 return "{}{}{}{} {}{}{}".format(
        random.choice(common.LETTERS),
        random.choice(common.LETTERS),
        random.choice(common.DIGITS),
        random.choice(common.DIGITS),
        random.choice(common.LETTERS),
        random.choice(common.LETTERS),
        random.choice(common.LETTERS))

how I can apply randomness on format

Thanks, in advance




Aucun commentaire:

Enregistrer un commentaire