Summary of knowledge points in Python that are afraid of forgetting (continuous update)

Source: Internet
Author: User

Tag: The div string is invalid return returns none of its SYS print

Only those parameters at the end of a formal parameter list can have default parameter values, that is, you cannot declare a function parameter by declaring a

The formal parameter of the default value is then declared without a default value for the formal parameter.

This is because the value assigned to the parameter is assigned according to the position. For example, Def func (A, b=5) is valid, but def func (a=5, b) is not valid.

Note that a return statement with no return value is equivalent to return none. None is a special in python that means nothing

Type. For example, if a variable has a value of none, you can indicate that it has no value.

The pass statement represents an empty block of statements in Python.

Def someFunction ():

Pass

The Convention for a document string is a multiline string whose first line begins with an uppercase letter and ends with a period. The second line is a blank line,

Starting with the third line is a detailed description. It is strongly recommended that you follow this convention when using a document string in your function.

You can use __DOC__ (note double underline) to call the document string property of the Printmax function (the name of the function)

From.. Import statement

If you want to enter the ARGV variable directly into your program (avoid playing sys every time you use it), then you can use

The FROM SYS import ARGV statement. If you want to enter all the names used by the Sys module, you can use the FROM sys

Import * statement. This is true for all modules. Generally, you should avoid using from. Import and use the import language

Because it will make your program easier to read and avoid conflicting names.

Summary of knowledge points in Python that are afraid of forgetting (continuous update)

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.