2.2.1名字错误

名字错误:python 的关键字写错了。 

NameError: name 'python3' is not defined

 

 现象:

 

python中的常见错误_python

 

 

2.2.2语法错误

python中的常见错误_python_02

SyntaxError: invalid syntax

 

无效的语法:Java 和 JS 一行结束用分号“;”Python 用的换行

2.2.3缩进错误

  python中的常见错误_python_03

 

 

NameError: name 'python3' is not defined

 

缩进错误:代码中有空格,没有对齐,Python 中缩进代表下一级(分支) 第一张 

第一节 第二节 

 

2.2.4中文乱码错误

 python中的常见错误_python_04

 

 

SyntaxError: Non-ASCII character '\xe8'

 

Python 2.x 默认不支持中文,具体原因,等到介绍 字符编码 时给大家讲解 Python 2.x 的解释器名称是 python
Python 3.x 的解释器名称是 python3 

 

2.2.5基础单词

* error 错误
* name 名字
* defined 已经定义,default 默认值 * syntax 语法

* invalid 无效 , valid 验证

* Indentation 索引
* unexpected 意外的,不期望的 * character 字符 char 

* line行 col 列

* encoding 编码
* declared 声明
* details 细节,详细信息 * ASCII 一种字符编码