Python's method for generating random passwords

  • 2020-06-03 07:10:38
  • OfStack

This article is an example of python to share the specific code to generate random 10-bit string, for your reference, the specific content is as follows


#coding:utf-8
# using python generate 1 A random 10 Bit string 
import string
import random
import re
list = list(string.lowercase + string.uppercase) + [ str(i) for i in range(10)]
FH = ('!','@','#','$','%','&','_')
for f in FH:
  list.append(f)
num = random.sample(list,10) 
''' Randomly take out 10 The number of '''
str=''
value = str.join(num) # To remove the 10 Random Numbers are recombined 
if not value[0].isdigit():
  print value

Related articles: