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.