Dec-05-2018, 10:33 PM
(This post was last modified: Dec-05-2018, 11:32 PM by Gribouillis.)
Quote:And what is the difference betweenThere are two hierarchies that don't coincide: the filesystem with its tree of folders and the python packages and subpackages system. For example
xml.etree.ElementTree
is a submodule of the xml.etree
package which is a subpackage of xml
.The
..one
means the subpackage 'one' of the current module's grandparent package. But you can't use it if you simply call python two/sample.py
because when you do so the current module is __main__
which has no parent package nor grandparent package. If works if parent
is a module with a subpackage two
and a submodule sample
, so it works if you call python -m parent.two.sample
.The filesystem tree helps to build python modules and packages, but there is no direct correspondance between them.