Python3 Learning DAY4

Source: Internet
Author: User

Some built-in functions and commonly used functions:

Built-in functions:
  • ABS: Returns the absolute value of a number.
  • Chr (number): ASCII converted to character, opposite function order
  • Divmod (NUM1, num2): The quotient and remainder are obtained, and a tuple is returned. Divmod (10,3) = (3,1)
  • Eval (source[, globals[, locals]): To find the value of an expression
  • Excefile (object[, globals[, locals]):The EXEC statement is used to execute a python statement stored in a string or file.
    • Example: Exec (' Print ("' abc ') ') output ' abc '
  • Filter (function or None, list): Each item of list is filtered by function. function, if a value is required to continue to exist, the return value is true and vice versa with false.
  • Len (object): Find the number of children of an object
  • Map (function, iterable_objects): Receives a function and an iterative object (such as a list) as a parameter, processes each element with a function, and then returns a new list.
  • Max (): Find the maximum
  • Min (): To find the smallest item
  • Ord (character): character converted to ASCII, opposite function Chr
  • Pow (x, y[, z]): exponentiation (z is optional for modulo)
  • Range (): Produce a list
  • Repr (object): Converts an object to a string, and many times the object can be restored by eval (repr (object))
  • SUM (list): Sums of all values of the sequence are evaluated
  • Type (object): View data Object type
  • Range ([Start,] stop[, step]), Range object: left open right closed.
  • Round (number[, ndigits]), number: Convert floating-point numbers to specified decimal digits
  • Hex (number): A string converted to 16 binary
  • Oct (number): string converted to octal
  • int (str): Character converted to numeric function
  • Float (object): Converts an object to a floating-point number.
  • Str (object): Converts an object to a string

Other functions:

    • Decimal: Controls the exact number of decimal places: (Need to be introduced first: from decimal import decimal)

Python3 Learning DAY4

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.