标识符、关键字、变量、语句、代码注释、模块
2.1 标识符
2.2 关键字
所有关键字都不能作为标识符,只有前三个首字母大写
2.3 变量
>>> s="hello world"
>>> print(s)
hello world
>>> y = 20
>>> y
20
>>> y = True
>>> y
True
>>> s = hello world
File "<stdin>", line 1
s = hello world
^
SyntaxError: invalid syntax
>>> greet =" hello world"
>>> greet
2.4 语句
2.5 代码注释
2.6 模块
2.7 动动手——实现两模块间的代码元素访问
hello.py
s = "hello world"
# print(s)
y = 20
x = "yellow"
z = True
world.py
y = 50
x = "blue"
z = False
import hello
from hello import x
from hello import y as y2
print(x) # yellow
print(y) # 50
print(y2) # 20
print(z) # False
print(hello.z) #True