Python的模块和包使得大量代码的维护更为方便
引用模块的方法:import 模块名 或者 from 模块名 import 函数名
import math
from math import pow, sin, log
由于函数调用时必须写明 包名.模块名.函数名 ,因此不存在同名冲突
动态导入模块:利用ImportError使得在引入模块失败时不影响程序运行
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
__future__模块:引入Python新版本的一些功能
from __future__ import division
print 10 / 3 #结果为3.333333333