mercredi 3 février 2021

Draw specific letters and numbers in python

I made a function to generate a combination of letters and random numbers in python:

from random import choice, random, sample

def generateKeyId(self):
    keyId = sample(ascii_uppercase,4)+sample(digits,4)+sample(ascii_uppercase,1)
    return ''.join(keyId)

this is one of the exits for example:

DCAT5087H

But what I really want is to generate an output with a combination of 1-200 and A-J Example:

6A

32F

60H

in that order, number and string.




Aucun commentaire:

Enregistrer un commentaire