Adios’ Notes
Adios Tsai


   

Search

November 2nd, 7:52am 0 comments

What is __init__.py used for?

Files named __init__.py are used to mark directories on disk as a Python package directories. If you have the files

mydir/spam/__init__.py
mydir/spam/module.py

and mydir is on your path, you can import the code in module.py as:

import spam.module

or

from spam import module

Loading mentions Retweet

Posted 8 months ago

Comments (0)

Leave a comment...

 
Got an account with one of these? Login here, or just enter your comment below.
Posterous-login    twitter