What exactly does “import *” import?

后端 未结 6 1275
梦如初夏
梦如初夏 2020-11-22 16:25

In Python, what exactly does import * import? Does it import __init__.py found in the containing folder?

For example, is it necessary to de

6条回答
  •  温柔的废话
    2020-11-22 16:57

    If the module in question (project.model in your case) has defined a list of stings named __all__, then every named variable in that list is imported. If there is no such variable, it imports everything.

提交回复
热议问题