#!/usr/bin/env python
#coding:utf8
#随机生成8位、20位、10位密码
import random
import string
all_chs = string.letters + string.digits
def gen_pass(num=8):
pwd = ‘‘
# num = int(raw_input(‘numer: ‘))
for i in range(num):
mima = random.choice(all_chs)
pwd += mima
return pwd
if __name__ == ‘__main__‘ :
print gen_pass()
print gen_pass(20)
print gen_pass(10)
本文出自 “You're the best” 博客,谢绝转载!
原文地址:http://20131104.blog.51cto.com/11444629/1908668