The Python package
Python modules is a single file, whereas a Python package is a collection of modules. A package is a directory that contains Python modules and one additional file: __init__.py
. What is the need of a package? Consider a team gets a project to convert the recording sound into MP3 format. One developer writes a code rectomp3.py
to convert the recording voice to MP3 sound in the sound_conversion
 directory. After some time, the team gets new requirements to convert the recording voice to .wav
format. Instead of writing in the rectomp3.py
file, we write our own code rectowav.py
 file in sound_conversion
. Then, a new requirement comes by where you need to convert the recording to WMA format. Again, a new author writes a new code rectowma.py
file in the same directory sound_conversion
. In this way, they make a package just adding one more file __init__.py
. Let's take a practical example.
Here, you can see the code rectomp3.py
in sound_conversion
:
#Written by Mohit def rec2mp3...