Python Verification code 6-bit Auto generator

Source: Internet
Author: User
Tags generator ord

Python Verification code 6-bit Auto generator

! /usr/bin/env python#-*-coding:utf-8-*-    ImportRandom tem=""       forIinchRange (6): Digi= Random.randrange (0,11)          ifDigi = = 1orDigi = = 5:## # # #当randrange (0,11) randomly generated number is 1 or 5 when,,,,:) is not a bit around Ah, hahahanum = Random.randrange (1,10) Num=str (num) TEM+=NumElse: ZM= Random.randrange (65,91) ZM=chr (ZM) TEM+=ZMPrint(TEM)
Note

#注: The greater the number of Digi, the less the chance of the IF, the smaller the number of digits that can be obtained.

#循环6次

The #定义空字符串 is to put the generated captcha characters and output them

#random () returns a randomly generated number corresponding to the ASCII code table

#chr () is the use of the ASCII Code table conversion, and Ord is the opposite

int (x [, Base]) converts x to         an integer  long (x [, Base]) converts X to        a long integer,  float (x) converts               x to a floating-point number  complex (real [, IMAG])  create a complex  str (x) to                 convert object x to String  repr (x) to                convert object x to expression string  eval (str)              Used to calculate a valid Python expression in a string, and returns an object  tuple (s) converts the               sequence s to a tuple list  (s) to                convert the sequence s to a listing  chr (x)                 Converts an integer to a character  UNICHR (x)              converts an integer to a Unicode character,  Ord (x)                 converts a character to its integer value,  hex (x)                 Converts an integer to a hexadecimal string  Oct (x)                 

Python Verification code 6-bit Auto generator

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.