Python Learning Record (basic-1), python record basics-1

Source: Internet
Author: User

Python Learning Record (basic-1), python record basics-1
Python Basics

 

 

1. Preface

Recently, I have been studying Python to summarize the learned knowledge and thoughts or ideas, so as to make the logical structure of my knowledge clearer and more thorough. Given the limited level of learning, some ideas and ideas will be implemented and solved in the future.

I use Python3.5, so the Python standard library references version 3.5.2.

2. Encoding Layout

#1. Start line (unix-like): The program can run with the input file name of the start line without calling the python interpreter. The absolute path of the file is written.

#2. Module document: briefly introduces the functions of the module and the meaning of global variables.

#3. Import Module.

#4. variable definition: the variables defined here are global variables, which can be directly used by functions in the module.

#5. Class Definition: All classes are defined here.

#6. function Definition: The function defined here can be executed using module. function.

#7. Main function: This part of code is executed no matter whether the module is imported or directly executed. This part mainly calls different functions and writes logic code.

3. Encoding Basic style Annotation

Make comments as concise and clear as possible. Put it in the right place.

Document

Python contains a variable of _ doc _ to obtain the document substring. Run with obj. _ doc.

Indent

Python developers intentionally violateIndent rulesPrograms can not be explained to force programmers to develop good programming habits, but also to facilitate everyone to search and read.

In addition, do not use the Tab key for indentation, because the program running on each platform has different indentation and different text editors are used to open the program. We recommend that you use a space to indent it.

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.