Python3 randomly generates a 6-digit verification Code

Source: Internet
Author: User

Python3 randomly generates a 6-digit verification Code

Requirements are numbers: 0~9 and uppercase and lowercase letters.

#!/usr/bin/env python#-*-coding:utf-8-*-# author:hiuhung wanimport random# 48--57:0-9# 65--90:a-z# 97--122:a-zinde  x = 6count = 0STR1 = "   #存放验证码while index > Count:    num = Random.randrange (48,122)    if (num <=) or (num >= and Num <=) or (num >=):   #符合条件        str1 + chr (num)        count + = 1print (str1)

  

The effect is as follows

C:\Python36\python.exe d:/py/1704/day04/Random Verification code. Pyypedp0process finished with exit code 0

  

Python3 randomly generates a 6-digit verification Code

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.