1.import
import引入或者叫做导入模块或者模块中的几个函数。
1)、导入模块
import 模块名
比如 import math
2)、导入某个包里或者多层包里的模块
(若干个包名).模块名
比如 import p1.math
import p1.p2.p3.math
3)、导入模块里的某几个函数
from 模块名 import 函数名,函数名,......
比如 from math import pow, sin, log
4)、导入模块里的函数,并给函数起别名-----防止引入了不同包里的
from 模块名 import 函数名 as 别名
比如:from math import log
from word import log as logging
2. __future__模块
当新版本的一个特性与旧版本不兼容时,该特性将会在旧版本中添加到__future__中。
如果要在旧的python版本中使用新的特性,就可以通过导入__future__模块的某些功能来实现。
比如 from __future__ import division
注意:__future__的引入语句,需要放在文件的最前边,不然会报错。