Revision: 21864
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 22, 2009 15:29 by magicrebirth
Initial Code
## Modules can be imported directly using the package or module name. Items in submodules must be accessed explicitly including the full package name. >>> import os >>> os.path.abspath(".") 'C:\\books\\python' ## Modules can be imported directly using the module name, but the namespace should be named something different. Items in submodules must be accessed explicitly including the full package name: >>> import os as computer >>> computer.path.abspath(".") 'C:\\books\\python' ## Modules can be imported using the module name within the package name. Items in submodules must be accessed explicitly including the full package name: >>> import os.path >>> os.path.abspath(".") 'C:\\books\\python' ## Modules can be imported by importing the modules specifically from the package. Items in submodules can be accessed implicitly without the package name: >>> from os import path >>> path.abspath(".") 'C:\\books\\python' ## Note: reload(module) ## This function that reloads a module. This can be extremely useful during development if you need to update a module and reload it without terminating your program. However, objects created before the module is reloaded are not updated, so you must be careful in handling those objects.
Initial URL
Initial Description
Initial Title
Python: using Modules
Initial Tags
python, module
Initial Language
Python