什么是A.在Python中的import语句中表示?

我正在查看Python的multiprocessing模块的代码,它包含这一行:

from ._multiprocessing import win32, Connection, PipeConnection

而不是

from _multiprocessing import win32, Connection, PipeConnection

细微的差别是_multiprocessing之前的时期。这是什么意思?为什么是经期?

86568 次浏览

That's the syntax for explicit relative imports. It means import from the current package.

The dot in the module name is used for relative module import (see here and here, section 6.4.2).

You can use more than one dot, referring not to the curent package but its parent(s). This should only be used within packages, in the main module one should always use absolute module names.

default one dot in your current folder, when you want to go parent folder you can do like this, my python version 3.6.3

enter image description here