库的导入
- 以math库为例
import math
math.sin(pi)
math.exp(2)
- 为库起一个别名,简化代码
import math as m
m.sin(x)
- 导入特定的库
上文中导入的库是导入全部的math库
from math import exp as e
e(1)#只能计算e
import math
math.sin(pi)
math.exp(2)
import math as m
m.sin(x)
from math import exp as e
e(1)#只能计算e