小功能函数记录-指定位数的随机码生成
1 # -*- coding:utf-8 -*- 2 3 __autor__ = "在路上_UP" 4 5 from random import choice 6 import string 7 8 def GenPasswd(length=8,chars=string.ascii_letters+string.digits): 9 return ''.join([ choice(chars) for i in range(length)]) 10 password = [] 11 for i in range(10000): 12 password.append(GenPasswd(16)) 13 print (GenPasswd(16)) 14 print(len(password))