28 packages in python
1. A package is basically a directory with Python files.
2. Using __init__.py file
we put several modules from different paths into a Package.
# To import all attrbutes from one package
from one import *
## To print name which exist in windows module
print(windows.name)
## To call os function which exsit in mac module
os()
## To call vmware function which exist in vmware module
vmware.vmware()
## To call sub function which exist in linux module
linux.sub()
# To import linux module from one package
from one import linux
# To import windows module from two package
from one.two import windows
# To import only os function from mac module
from one.three.mac import os
## To call sub function from linux module
linux.sub()
## To print name variable form windows module
print(windows.name)
## To call os function which imported from mac module
os()
Comments
Post a Comment