近期在看源码时发现了这个问题,百度了半天没有查到,在StackOverflow上找到了,记录一下

类似的代码就像这种,from后面的包前面有一个点

from ._utils import _import_dotted_name
from ._utils_internal import get_file_path, prepare_multiprocessing_environment
from .version import __version__
from ._six import string_classes as _string_classes

https://stackoverflow.com/questions/7279810/what-does-a-in-an-import-statement-in-python-mean

https://stackoverflow.com/questions/22511792/python-from-dotpackage-import-syntax

https://docs.python.org/3/tutorial/modules.html#importing-from-a-package            见6.4.2. Intra-package References

https://docs.python.org/release/2.5.2/ref/import.html#tok-relative_module

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐