Use of Python methods

Source: Internet
Author: User

1. Function definitiondef function name (formal parameter):function Bodyreturn value2. Function Executionfunction name (argument)3, the parameters passed in the parameter by default is the number, in order one by one corresponds, you can also specify that the parameters are not in order 4. Parameter with default parameters to be placed after formal parameter without default function5. Parameter with * indicates the dynamic parameters of tuple typea parameter with a * * indicates the dynamic parameters of the dictionary type(both are automatically converted according to the argument type, and one * is preceded by two *)In general, the parameter name with * is used with *args,** **kwargs7, for dynamic parameter incoming list, tuple, dictionary *args with * list name or * tuple name, **kwargs with * * Dictionary name is represented8. Global variables: Global can be used globally to change global variables within a functionLocal variables: variables within a function that cannot be used outside the function (for better resolution, the best global variables are capitalized, local variables are lowercase) 9. Function name can be passed as parameter, function name refers to function, function name plus () means execution function10, function recursion, function inside nested itself function

Use of Python methods

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.