Modules (packages, libraries) are collections of functions that needs to be assinged (imported) with
import before using it in Python.1) function call requires module prefix
import math x = math.log(5) 2) import all module functions to use without modul prefix
from math import * x = log(5) 3) import only selected functions
from math import log, sqrt, sin x = log(5)
4) change name of imported function
from math import log as ln x = ln(5) 5) change name of imported module import math as m x = m.log(5) Note, external modules needs to be locally installed on the computer before importing in Python.
Install Modules
http://docs.python.org/2/install/index.html#standard-build-and-installhttp://docs.python.org/2/install/index.html#alternate-installation |
Packages >