From a quick search, I know that one dot means in the current directory, two dots mean in the parent directory, and three dots mean in the grandparent directory, but these examples are usually written as from .. import PackageName
What if the code was just import ...
? Does this import every file in the grandparent directory? (The reason why I ask is that I'm working with some files that has this import statement at the top, but there is nothing in the grandparent directory to import).
The dots mimic the Unix file system that .
refers to the current directory and ..
refers to the parent. ...
has no such conventional meaning. In Python, however, ...
is the literal for the singleton value of the ellipsis
class:
>>> type(...)
<class 'ellipsis'>
As such, import ...
would be a syntax error, as ...
is not a valid module name.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.