1、类似 import numpy 或from helloworld import hello
2、使用系统函数__import__() 类似于np = __import__('numpy')
3、使用exec 类似于np="import numpy as np",然后执行exec(np)
另外: 查看所有变量用locals(),dir()
查看变量是否具有某属性和方法,用hasattr(string,'count'),就是判断变量string是否具有count属性(方法)
查看
1、类似 import numpy 或from helloworld import hello
2、使用系统函数__import__() 类似于np = __import__('numpy')
3、使用exec 类似于np="import numpy as np",然后执行exec(np)
另外: 查看所有变量用locals(),dir()
查看变量是否具有某属性和方法,用hasattr(string,'count'),就是判断变量string是否具有count属性(方法)
查看