The ‘__init__.py’files are required to make Python treat thedirectories as containing packages; this is done to preventdirectories with a common name, such as ‘string’
, fromunintentionally hiding valid modules that occur later on the modulesearch path. In the simplest case, ‘__init__.py’can just be anempty file, but it can also execute initialization code for thepackage or set the __all__variable, described later.
要创建python包,必须创建__init__.py,只要文件夹下面有这个文件,哪怕是一个空文件,python就认为这是一个包,而不是文件夹。
引用自:An Introduction to Python