是import在程序中的使用

 

【一】函数load_source

imp.load_source(moduleName, sourceFile)

 

使用:

abc = imp.load_source('def', '/home/fanruoxin/xxx.py')

得到结果:

abc是模块的变量名,使用abc.a调用变量或者模块之类的

‘def’是模块名,在sys.module中,'def'是一个key, 

相关文章:

  • 2021-11-24
  • 2021-11-16
  • 2021-10-28
  • 2021-04-27
  • 2021-10-29
  • 2021-06-11
  • 2021-11-16
猜你喜欢
  • 2021-09-24
  • 2021-10-21
  • 2022-02-15
  • 2021-10-07
  • 2021-11-15
  • 2021-12-06
相关资源
相似解决方案