#!/usr/bin/python
#-*-conding:utf-8-*-

#密码随机生成器,密码长度由用户输入,用户可以自己设置密码长度
import random
import string

def getRandompwd(pwd_length):
    password = ''
    for i in range(pwd_length):
        password = str(password + str(random.randrange(0,10)))
    print(password)
        

pwd_length = int(input("please input the password length:"))
getRandompwd(pwd_length)

 运行:

please input the password length:6
077558

 

相关文章:

  • 2022-12-23
  • 2022-01-18
  • 2021-07-23
  • 2022-01-24
  • 2022-01-15
猜你喜欢
  • 2021-12-09
  • 2021-07-02
  • 2021-10-06
相关资源
相似解决方案