0130-实例之python实现随机验证码.abb

数字转换为字母

chr(66) 65 -90 是大写字母

import random 

temp  = ""

for i in range(4):

  num = random.randrange(0,4)

  if num ==3 or num ==1

    rad2 = random.randrange(0,10)

    temp+=str(rand2)

  else:

    i = random.randrange(65,91)   

    temp+= chr(i)  

获得四位随机大写字母

原文地址:https://www.cnblogs.com/qianzi/p/6408679.html