用random模块实现按照要求生成一定个数和一定位数的密码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#Author by Andy
#_*_ coding:utf-8 _*_
import random
checkcode=''
code='''abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789!@#%&()*"{}'''
code_len=int(input('请输入密码长度:'))
code_count=int(input('请输入密码个数:'))
count = 0
while count < code_count:
    checkcode = ''
    for i in range(code_len):
        j=random.randint(0,len(code)-1)
        checkcode += code[j]
    print(checkcode)
    count+=1

  

用random模块实现按照要求生成一定个数和一定位数的密码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#Author by Andy
#_*_ coding:utf-8 _*_
import random
checkcode=''
code='''abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789!@#%&()*"{}'''
code_len=int(input('请输入密码长度:'))
code_count=int(input('请输入密码个数:'))
count = 0
while count < code_count:
    checkcode = ''
    for i in range(code_len):
        j=random.randint(0,len(code)-1)
        checkcode += code[j]
    print(checkcode)
    count+=1

  

相关文章:

  • 2021-11-02
  • 2021-12-24
  • 2021-11-14
  • 2022-12-23
  • 2021-12-03
  • 2021-12-27
猜你喜欢
  • 2021-10-02
  • 2021-10-10
  • 2021-04-06
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案