dimanche 30 juin 2019

Generate a random string excluding certain special characters in python

I just started learning coding. I was trying to create a password generator in python. After researching this website, I found that I can use,

random.SystemRandom().choice(string.punctuation)

My question is, How can I generate random characters from the set of punctuation excluding the special characters '#$~' etc?

s=random.SystemRandom().choice(string.punctuation)

I would like my variable s to have random special characters excluding a few of my choice.




Aucun commentaire:

Enregistrer un commentaire