CBSE Class 12 Computer Science Question 37 of 62

Using Python Libraries — Question 5

Back to all questions
5
Question

Question 5

What is the use of file __init__.py in a package even when it is empty ?

Answer

The use of file __init__.py in a package even when it is empty is that without the __init__.py file, Python will not look for submodules inside that directory, so attempts to import the module will fail. Hence, the file __init__.py in a folder, indicates it is an importable Python package.