标签: python python-2.7 import module
有没有办法从内存中导入模块,例如,如果我要将python模块存储在数据库中,然后查询它,有没有办法将该字符串导入当前的本地范围而不将其写入磁盘?例如:
模块(作为字符串):
def lol(x): return x
访问:
def import_into_this_func_scope(): x= query_from_db() import x x.lol("hello world")