有什么作用?在 Python 中的 import 语句中是什么意思? [英] What does a . in an import statement in Python mean?

查看:26
本文介绍了有什么作用?在 Python 中的 import 语句中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm looking over the code for Python's multiprocessing module, and it contains this line:

from ._multiprocessing import win32, Connection, PipeConnection

代替

from _multiprocessing import win32, Connection, PipeConnection

细微差别是 _multiprocessing 之前的句点.这意味着什么?为什么是期间?

the subtle difference being the period before _multiprocessing. What does that mean? Why the period?

推荐答案

这是显式相对进口.表示从当前包导入.

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

这篇关于有什么作用?在 Python 中的 import 语句中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆