Python> __init__.py> Required to handle the specified directory as a package (empty file is acceptable)

@ Introducing Python: Modern Computing in Simple Packages by Bill Lubanovic (No. 3104 / 12833)

a file named __init__.py. This can be empty, but Python needs it to treat the directory containing it as a package.

Related: What is __init__.py for?

answered Nov 7 '10 at 3:31 caritos An example of importing mydir / spam / is introduced in the answer by.

Recommended Posts

Python> __init__.py> Required to handle the specified directory as a package (empty file is acceptable)
A story that struggled to handle the Python package of PocketSphinx
Recursively search the specified directory to see the file
I created a script to check if English is entered in the specified position of the JSON file in Python.
Create a python script to check if the link at the specified URL is valid 2
Create a python script to check if the link at the specified URL is valid
[Introduction to Python] What is the recommended way to install pip, a package management system?
I want to initialize if the value is empty (python)
[python] Change the image file name to a serial number
Change the standard output destination to a file in Python
Python> library> os> os.walk ()> Get directory structure / Implementation to get each file path in the specified directory
A story that is a little addicted to the authority of the directory specified by expdp (for beginners)
Create a shell script to run the python file multiple times
Normalize the file that converted Excel to csv as it is.
Get the formula in an excel file as a string in Python
How to input a character string in Python and output it as it is or in the opposite direction.
[Python] What is a formal argument? How to set the initial value
What is the XX file at the root of a popular Python project?
Migration from Python2 to Python3 (Python2 is rebuilt as a virtual environment and coexists)
How to install python package in local environment as a general user
Test & Debug Tips: Create a file of the specified size in Python
Read CSV file with Python and convert it to DataFrame as it is
I made a program to check the size of a file in Python
What is the fastest way to create a reverse dictionary in python?
<Python> A quiz to batch convert file names separated by a specific character string as part of the file name
[python] [meta] Is the type of python a type?
Create a deb file from a python package
[Python] Read the specified line in the file
Directory move tool to Python package (pycd)
Various ways to read the last line of a csv file in Python
I want to get the path of the directory where the running file is stored.
How to read all the classes contained in * .py in the directory specified by Python
I tried to explain what a Python generator is for as easily as possible.
Output timing is incorrect when standard (error) output is converted to a file in Python
[Python] I tried to get the type name as a string from the type function
How to get a list of files in the same directory with python
How to disguise a ZIP file as a PNG file
How to create a JSON file in Python
Save the object to a file with pickle
A python amateur tries to summarize the list ②
I want to write to a file with Python
As a beginner, I searched the / proc directory
How to read a file in a different directory
[Python] Throw a message to the slack channel
How to use pip, a package management system that is indispensable for using Python
When publishing a package to PyPI, "HTTP Error: 400 Client Error: File already exists." Is displayed.
How to list files under the specified directory in a list (multiple conditions / subdirectory search)
[Python] Save the video data imported by OpenCV as a serial number jpg file
[Python] You can save an object to a file by using the pickle module.
How to check in Python if one of the elements of a list is in another list
Output the specified table of Oracle database in Python to Excel for each file
Don't take an instance of a Python exception class directly as an argument to the exception class!
[Python] If you create a file with the same name as the module to be imported, an Attribute Error will occur.