jeudi 15 août 2019

Generate random string with python for a string(mix of int and chars) with particular lenght

Need to generate random string as follows

first 5 strings should be alphabet in caps Next 4 should be integers and one alphabet at last

output i need examples:

ACCE1664Z
BCED1782V
FBCR9126N



tried this

import uuid

def StringDigits(leng):

        id = uuid.uuid1()

        id = str(id)

        id = id.replace("-","")

        return id[0:leng]



if i try this StringDigits(10) it is generating random string.




Aucun commentaire:

Enregistrer un commentaire