我有一个模块my_module,它由许多文件来源(导入)使用:
from my_module import *
在模块内部,我可以知道导入此模块的文件是什么?
我想知道文件名:line_no进行了这个导入.
所以我需要的代码是:
my_module.py
print "This module is currently imported from: file:line_no = %s:%s" % what_in_here??
Run Code Online (Sandbox Code Playgroud)