Python Automation 3rd Lesson

Source: Internet
Author: User
Tags set set

The main topic of this lesson
    • Set set and Operation combat
    • function Introduction and Operation combat
    • In-depth introduction to the parameters and operational combat
    • Format Function Operation Combat
    • Lambda Form-Intro
    • File Operation function Introduction and operation combat
    • Demand for Business
Set set and Operation combat

[Updating in progress]

function Introduction and Operation combat

Before the function is learned, the code we implement is to use many conditions to judge (If-then-else) and the expression of the For loop to implement the function, there are many repeated code, in fact, this process is called " process-oriented programming ", from top to bottom according to the logic 1.1 to write, If repeated functionality is encountered, the most type of operation is copying and pasting (copy and Paste)

Disadvantages of process-oriented programming :

    1. If the amount of code, continuous copying and pasting, will lead to the lack of readability of the code;
    2. The use of repeated code, the number of password, the program is also very tired, will guide the lack of reusability .

* * Summary: Based on the above two points of the solution bin case is the use of functional formula!!!! function is used to seal certain functions, it is to increase the reusability of the code, so that the code is more simple, and can increase its accessibility, and then if you want to use it directly adjust the function on the line!!

The steps to create the function are as follows:

    1. Use the def keyword to declare that this is a function;
    2. Add a space to the Def and then write a name that represents the function name , which you can then invoke in memory;
    3. The name is added with a parenthesis ();
    4. Then write the contents of the function in the function body : It is the function that needs to be realized;
    5. Then add the return value, and if there is no return value, Python will have a default return value (None)
    6. The function can enter parameters inside the parentheses.

In-depth introduction to the parameters and operational combat

[Updating in progress]

Format Function Operation Combat

[Updating in progress]

Lambda Form-Intro

[Updating in progress]

File Operation function Introduction and operation combat

[Updating in progress]

Demand for Business

[Updating in progress]

Python Automation 3rd Lesson

Related Article

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.