Python implements a random verification code of 6 letters + numbers

Source: Internet
Author: User

For i in range (4):       #循环4次     rad1 =  random.randrange (0,6)          #每一次循环随机一个0至6之间的一个数      if rad1 == 1 or rad1 == 3:            #判断如果rad1变量随机数等于1或者等于3         rad2 =  random.randrange (65,91)        #每一次循环随机一个65至91之间的一个数          c1 = str (rad2)        #将随机数转换成字符串          suij3 = suij3 + c1       #将转换的字符串赋值给, statistical random numbers     else:        #如果rad1变量随机数不等于1或者3         rad3 = random.randrange (65,91)         #每一次循环随机一个65至A number between 91         C2 = CHR (RAD3)         #将随机到的数以十进制的ascii码转换成对应字母         suij3 = suij3 +  c2       #将转换的字母赋值给, Statistical random number print (SUIJ3)           #打印出统计随机数


Python implements a random verification code of 6 letters + numbers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.