- Secret Recipes of the Python Ninja
- Cody Jackson
- 134字
- 2021-06-25 22:14:43
How to create and reference module packages
We have talked about modules and packages, using the terms interchangeably. However, there is a difference between a module and a package: packages are actually collections of modules and they include a __init__.py file, which can just be an empty file.
The dot-nomenclature used in modules to access specific functions or variables is also used in packages. This time, dotted names allow multiple modules within a package to be accessed without having name conflicts; each package creates its own namespace, and all the modules have their own namespaces.
When packages contain sub-packages (as in the following example), importing modules can be done with either absolute or relative paths. For example, to import the sepia.py module, one could import it with an absolute path: from video.effects.specialFX import sepia.
- 一步一步學Spring Boot 2:微服務項目實戰
- Unreal Engine Physics Essentials
- 密碼學原理與Java實現
- 工程軟件開發技術基礎
- PyTorch自動駕駛視覺感知算法實戰
- 單片機C語言程序設計實訓100例
- 零基礎學Kotlin之Android項目開發實戰
- Unity 3D/2D移動開發實戰教程
- Mastering Web Application Development with AngularJS
- Django 3.0入門與實踐
- HTML5+CSS3+jQuery Mobile APP與移動網站設計從入門到精通
- 平面設計經典案例教程:CorelDRAW X6
- Java EE項目應用開發
- Visual FoxPro程序設計實驗教程
- 編寫高質量代碼之Java(套裝共2冊)