September 2013
Intermediate to advanced
350 pages
9h 38m
English
To gain access to the variables and functions from a module, you have to import it. To tell Python that you want to use functions in module math, for example, you use this import statement:
| | >>> import math |
Importing a module creates a new variable with that name. That variable refers to an object whose type is module:
| | >>> type(math) |
| | <class 'module'> |
Once you have imported a module, you can use built-in function help to see what it contains. Here is the first part of the help output:
| | >>> help(math) |
| | |
| | Help on module math: |
| | |
| | NAME |
| | math |
| | |
| | MODULE REFERENCE |
| | http://docs.python.org/3.3/library/math |
| | |
| | The following documentation is automatically generated from the Python |
| | source files. It may ... |
Read now
Unlock full access