Python self-bringing function

Source: Internet
Author: User

Callable ()#whether it can be executed, whether it can be calledChr ()#returns the ASCII character corresponding to the integer i. Contrary to the Ord () effect. Parameter x: A positive number between the range of values [0, 255]. Ord ()#The parameter is an ASCII character, and the return value is the corresponding decimal integerRandom.randrange (1,5)#randomly generate a numberR = Compile (s,"<string>","exec")#to compile a string into Python codeexec(r)#execution code, a receive code (compiled), a receive string (You can build it yourself and then execute it). No return valueEval ()#You can only execute an expression with a return value. Dir ()#quickly get what features an object providesHelp ()#View feature DetailsDivmod ()#Division, taking the remainderIsinstance ()#determine if an object is an instance of a classFilter ()#Loop The second argument so that each loop element executes the function if the function return value is true, added to the result list. If False, the operation is not done. Hex ()#Ten---> 16 binaryFilter ()#Loop The second argument so that each loop element executes the function if the function return value is true, added to the result list. If False, the operation is not done. Print(ABS (-1))#take absolute valuePrint(bool ([]))#0,none, "", [], () are null valuesn = All ([1,2,3,none])#All is true, only is trueN1=any ([[],"", 1])#As long as one is true, it is true.#string conversion byte type#bytes (as long as the converted string, according to what code)st="Understanding" #One byte 8 bits, one kanji three bytesN=bytes (st,encoding="Utf-8")Print(n) N2= Bytes (st,encoding="GBK")Print(n2)#bytes into a stringNEW_STR = STR (n, encoding="Utf-8") New=n.decode ("Utf-8")Print(new)Print(NEW_STR)


I want to add ....

Python self-bringing function

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.