Carambola Python Basics Tutorial - Chapter 4: Python basic grammar

I CSDN blog column: HTTPS: //blog.csdn.net/yty_7
Github Address: https: //github.com/yot777/Python-Primary-Learning

 

4.1  coding identifier and comments

4.2  line and indented

 

4.1 coding identifier and comments

 

By default, the Python. 3 source files to UTF-8 encoding, all strings are unicode string

 

Python first character of the identifier must be a letter of the alphabet or underscore '_' .

The other part of the identifier letters, digits, and underscores.

Identifiers are case sensitive.

 

Python in Single-line comments # begin with, multi-line comment with three single quotation marks ( '' ' ), or three double quotation marks ( "" " ) to enclose comments.

 

4.2 line and indented

 

And most programming languages have a specific line endings different , Python use indentation and line breaks to represent the hierarchical structure of the code. The number of spaces to indent is variable, but with a Python all statements in the file must contain the same number of spaces to indent.

In an example, each of the custom . 4 spaces as a layer structure

4 * 2 spaces is a second layer structure

4 * . 3 spaces is the third layer structure

This principle must be maintained throughout the program

Not at liberty to indent

 

Reference Tutorial:

Liao Xuefeng of Python tutorials

https://www.liaoxuefeng.com/wiki/1016959663602400

Liao Xuefeng's Java Tutorial

https://www.liaoxuefeng.com/wiki/1252599548343744

Python3 Tutorial | Tutorial rookie
https://www.runoob.com/python3/

 

If you feel Benpian chapter has helped you, welcome attention, comments, thumbs up! Github welcome you Follow, Star!

 

Published 25 original articles · won praise 3 · Views 2173

Guess you like

Origin blog.csdn.net/yty_7/article/details/104116077