# cat genpass.py from random import choice import string def GenPasswd(length=20, chars=string.letters+string.digits): return ‘‘.join([choice(chars) for i in range(length)]) for i in range(6): print GenPasswd(20)
运行结果为:
# python genpass.py mv2yMlDEyQFcujkh7ttM 4fNmbh2atrcrsrKm1f3t UKRPsUsdZ951uQBdtPhS bAuHJUbNXBSjB5IVibQO d7Dl0VGAOI0LcGlnJOeR qb2WEHwHTVYK51gZsa2V
本文出自 “天道酬勤” 博客,请务必保留此出处http://lavenliu.blog.51cto.com/5060944/1688563
原文地址:http://lavenliu.blog.51cto.com/5060944/1688563