需求:

  随机生成6位的验证码,要求有字母和数字

import random

temp = ""
for i in range(6):
    j = random.randrange(0,2)
    if j = 0:
        rand1 = random.randrange(0,10)
        temp += str(rand1)
    else:
        rand2 = random.randrange(65,91)
        temp += chr(rand2)
print(temp)

 

相关文章:

  • 2021-04-22
  • 2022-12-23
  • 2021-11-27
  • 2021-06-24
  • 2021-07-13
  • 2021-07-08
猜你喜欢
  • 2021-08-13
  • 2022-12-23
  • 2021-06-26
  • 2021-06-21
  • 2021-11-12
  • 2021-10-08
相关资源
相似解决方案