1. Write Python code principles:
Uniform indentation, the same level indentation must be consistent, different levels must be more indented;
Shelf start writing, can not have spaces;
Variable
It is recommended that you write on the Windows-side installation Pychram program.
2. Variable Name requirements:
The first character of the identifier must be the letter in the alphabet (either uppercase or lowercase) or an underscore _
Other parts of the identifier name can consist of a letter (uppercase or lowercase), an underscore _, or a 0-9 number
Identifier names are case-sensitive
You cannot use commands in Python
3. How to define Python environment variables and encodings
The first line of the program declares, such as: #!/usr/bin/env python
declaration Code format U tf-8: #-*-Coding:utf-8-*-#这样可以免除中文乱码
Such as:
#!/usr/bin/env Pyhon
#-*-Coding:utf-8-*-
4, how to comment:
Such as:
info = "Print test1
Test2
Test3 ""
Print Info
This article is from the "Chhhsdbohe" blog, make sure to keep this source http://437972.blog.51cto.com/427972/1835467
Basic Python Learning 1