python 生成动态密码
import string
import random
def gen_psd(length=10):
"""length is password length"""
letters = string.ascii_lowercase + string.digits
times = length/len(letters)+1
#print('times: ', times)
pswd = ''.join([random.choice(letters*int(times)) for _ in range(length)])
return pswd
if __name__ == '__main__':
print(gen_psd(57))