In recent knowledge learning pathon3 can be said to be a white, or just the pure, natural pollution-free, ha ha, well, not much gossip said that today's learning experience simple record.
Existing file structure as follows:
| src/
||mode1.py
|| lib/
||| a.py
||| b.py
If you want to use the function a.py in the mode1.py, the need to create __init__.py file in the lib / directory. And there __all__ = [ "a", "b", "..."] indicates the current directory module.
If you want to use a function in a.py mode1.py, you need to import sys in mode1.py, the first call sys.path.append ( ".."), jump to the parent directory, and then import mode1 is OK a.
Simple records on here.
The following is a look at when I learned written by someone else, stick together out here: https: //blog.csdn.net/IT_jiao/article/details/84887364