function Call of Python function

Source: Internet
Author: User

Python has built in a lot of useful functions that we can call directly.

To invoke a function, you need to know the name and parameters of the function, such as a function that asks for an absolute value abs , and only one argument. Documents can be viewed directly from the official Python website:

Http://docs.python.org/3/library/functions.html#abs

You can also help(abs) view the abs function's help information on the interactive command line.

1. Call abs function:
>>> ABS (100>>>) abs ( -20)20>>> abs (12.34)12.34

2. Data type conversion

Python's built-in common functions also include data type conversion functions, such as int() functions that convert other data types to integers:

>>> int ('123')123>>> int (12.34)12>>> Float ('12.34')12.34>>> str (1.23)'1.23  '>>> str ' [+]>>> bool (1  ) True>>> bool (") False

3, function name is actually a reference to a function object, it is possible to assign a function name to a variable, which is equivalent to the function of an "alias"
# variable a points to the ABS function # so you can also call the ABS function by a 1

Reprinted from: Https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/ 0014316784721058975e02b46cc45cb836bb0827607738d000

function Call of Python 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.