标识符
首字符是字母或下划线
其余可以是字母、下划线、数字
大小写敏感(PI和pi是不同的标识符)
Python does not allow punctuation characters such as @, $, and % within identifiers.
Lines and Indentation
python无括号,语句结构依赖每行前的空格数判断
Multi - Line Statements
Statements in Python typically end with a new line. Python does, however, allow the use of the line continuation character (\) to denote that the line should continue. For example:
Statements contained within the [], {}, or () brackets do not need to use the line continuation character. For example:
case1:以[]申明即列表
case2:以()声明即元组
case3:以{}声明即映射
Quotation in Python
三种类型:'' ,'' '',''' '''.
区别在于三引号可跨越多行
eg.
注意用三引号后,输出内容中带有 \n
Comments in Python
# 用来做注解
Using Blank Lines
函数之间或类之间用空行分隔,表示一段新的代码的开始。
类和函数入口之间也用一行空行分隔,以突出函数入口的开始。
简单的讲,就是分隔不同功能的代码块
Waiting for the User
Multiple Statements on a Single Line
用 ; 实现一行使用多条语句
关键字
不可作为标识符名
andas assert break class continue def del
elif else except exec finally for from global if import in is lambda not or pass print raise return try while with yield