Common built-in functions for the Python language

Source: Internet
Author: User

One write at the beginning
This article lists some of the commonly used python built-in functions. For a complete and detailed list of Python built-in functions, see the built-in functions section of the Python documentation.

Two python common built-in functions
Please note that the detailed application of the built-in functions and considerations must be found in the official Python documentation. A short summary of the following may have subtle flaws.

Function Function Example Results
ABS (x) Returns the absolute value of X ABS (-5) 5
Chr (x) Returns the character represented by the integer x Chr (65) A
Divmod (x, y) Returns a tuple of quotient and remainder consisting of x divided by Y Divmod (44,6) (7,2)
Float (x) Convert x to floating point Float (' 56 ') 56.0
Hex (x) Convert x to hexadecimal number Hex (34) 0x22
int (x) Convert x to Integer Int (34.21) 34
Len (x) Returns the number of elements in parameter X Len ([1,3,5,7]) 4
Max (List-type parameter) Returns the maximum value in parameter X Max (1,3,5,7) 7
MIN (list type parameter) Returns the minimum value in parameter X Min (1,3,5,7) 1
Oct (x) Convert X to eight decimal Oct (34) 0o42
Ord (x) Returns the Unicode encoding of the character X Ord (' Me ') 25105
Pow (x, y) Returns the Y-order of X Pow (2,3) 8
Round (x) Returns the value of four six in X (note that the four six into) Round (45.8) 46
Sorted (list) Sort by small to large Sorted ([3,1,7,5]) [1,3,5,7]
STR (x) Convert X to String STR (56) 56 (String)
SUM (list) Calculate the sum of elements in a list SUM ([1,3,5,7]) 16
Type (object) Returns the data type of an object Type (34.0) Float

Three references

1. Learn Python without obstacles

Common built-in functions for the Python language

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.