Python Learning record (Basic)

Source: Internet
Author: User

Python Basics

1. Write in front

Recently, I have been learning python to summarize some of the thoughts and ideas that have been learned and learned, so as to make your knowledge logical structure appear clear and let yourself know more thoroughly. Given the limited level of learning, some ideas and thinking will remain in the future to achieve and solve.

I use the Python3.5 version again, so the Python standard library is referenced by the 3.5.2 version.

2. Coded layout

# 1. Start Line (Unix-like): The program with the starting line will enter the file name to run, no need to call the Python interpreter, write the absolute path of the file.

# 2. Module Documentation: A brief description of the function of the module, the meaning of the global variable.

# 3. Import module: Import all the modules required by the current module, the module will be imported only once, generated by the interpreter explained the file, specifically written to the module and then specific.

# 4. Variable definition: The variable defined here is a global variable, and the function in the module can be used directly.

# 5. Definition of class: All classes are defined here.

# 6. Function definition: The function defined here can be executed with module.function ().

# 7. Main function: This part of the code executes regardless of whether the module is imported or executed directly. This part of the main is to call different functions, write some logical code.

3. Coding basic Style annotations

Develop the habit of commenting, as concise as possible. Put it in the right place.

Document

There is a __doc__ variable in python that gets the text string. Run with obj.__doc__.

Python Learning record (Basic)

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.