Changes in import statement python3

前端 未结 4 1866
执笔经年
执笔经年 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:54

    Added another case to Michał Górny's answer:

    Note that relative imports are based on the name of the current module. Since the name of the main module is always "__main__", modules intended for use as the main module of a Python application must always use absolute imports.

提交回复
热议问题