Changes in import statement python3

前端 未结 4 1864
执笔经年
执笔经年 2020-11-22 04:54

I don\'t understand the following from pep-0404

In Python 3, implicit relative imports within packages are no longer available - only absolute impor

4条回答
  •  孤城傲影
    2020-11-22 05:42

    To support both Python 2 and Python 3, use explicit relative imports as below. They are relative to the current module. They have been supported starting from 2.5.

    from .sister import foo
    from . import brother
    from ..aunt import bar
    from .. import uncle
    

提交回复
热议问题