8
I’m starting to work deeper with Python and have noticed many projects with files __int__.py
in folders, and are often blank.
What is the purpose of these files?
8
I’m starting to work deeper with Python and have noticed many projects with files __int__.py
in folders, and are often blank.
What is the purpose of these files?
6
It is part of a package. See the python documentation.
The archives
__init__.py
are required to make Python handle directories containing packages, this is done to avoid directories with common names, such asstring
, that unintentionally hides in the validated modules, those that will be searched in the path. In the simplest case, the file__init__.py
can only be a empty file, but it also executes the initialization code for the package or set variable__all__
, described later.
2
__init__.py files are used to declare to the python interpreter that the directory they are in contains python script files. Example:
diretoria/
__init__.py
ficheiro_a.py
ficheiro_b.py
ficheiro_c.py
Browser other questions tagged python
You are not signed in. Login or sign up in order to post.