mardi 1 octobre 2019

Exclude a particular character from being generated by random.choice()

I am trying to generate random characters using random.choice(string.ascii_lowercase). I do not want to include all the lowercase characters in the random.choice(). I want to exclude some

import random 
import string

random.choice(string.ascii_lowercase)

choice to select from 'abcdefghijklmnopqrstuvwxyz' exclude 'abd' from the choice generated by the random function




Aucun commentaire:

Enregistrer un commentaire