importlib模块与__import__都可以通过过字符串来导入另外一个模块,但在用法上和本质上都有很大的不同。

通过下面示例说明,有如下一个工程目录:

importlib模块与__import__详解

name = 'test'


def getName():
    print(name)
lib/test.py

相关文章:

  • 2022-01-21
  • 2021-06-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-15
  • 2021-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-24
  • 2021-06-14
  • 2022-12-23
  • 2021-12-08
  • 2022-12-23
相关资源
相似解决方案