Of. import xxxx

In one of my Python packages, the file __init__.pycontains a statement

from . import XXXX

What does "." Mean mean here? I got this technique by looking at another package, but I don't understand what that means.

Thank!

+5
source share
2 answers

This is a relative import .

+5
source

Its relative imports. From: http://docs.python.org/py3k/reference/simple_stmts.html#the-import-statement

. . , .

, , . . - .. , from . import mod pkg, pkg.mod. ..subpkg2 import mod pkg.subpkg1 pkg.subpkg2.mod. PEP 328.

+10

All Articles