#!/usr/bin/python
## Use: Make Random Password
## Date: 2013-9-10
## File: getpasswd.py By Mislost
import string
from random import choice
##define passwd's length and count
passwd_length = 20
passwd_count = 10
##define the seed of passwd
passwd_format = string.digits + string.ascii_letters + string.punctuation
def get_passwd():
##defind a apace list for passwd
passwd = []
##use choice function create passwd
while (len(passwd) < passwd_length):
passwd.append(choice(passwd_format))
## return a complele password.
return ''.join(passwd)
if __name__ == '__main__':
##print 10 passwords
for i in range(0,passwd_count):
print get_passwd()
</span>
python生成随机密码脚本
最新推荐文章于 2023-07-04 22:08:38 发布