标签:ring 密码 load ase 字符 orm dig cas oct
>>> import string
>>> dir(string)
[‘Formatter‘, ‘Template‘, ‘_ChainMap‘, ‘_TemplateMetaclass‘, ‘__all__‘, ‘__
ins__‘, ‘__cached__‘, ‘__doc__‘, ‘__file__‘, ‘__loader__‘, ‘__name__‘, ‘__p
e__‘, ‘__spec__‘, ‘_re‘, ‘_string‘, ‘ascii_letters‘, ‘ascii_lowercase‘, ‘as
ppercase‘, ‘capwords‘, ‘digits‘, ‘hexdigits‘, ‘octdigits‘, ‘printable‘, ‘pu
tion‘, ‘whitespace‘]
import random,string password="" s=string.digits+string.printable+string.ascii_letters #生成包含大小写字母、符号的字符串 for i in range(9): #生成长度为9的密码 password+=random.choice(s) #使用random的内置函数choice print(password)
不到十行代码搞定!
标签:ring 密码 load ase 字符 orm dig cas oct
原文地址:https://www.cnblogs.com/testerren/p/10336378.html