小编mun*_*ree的帖子

知道文件名:line_no,其中导入了my_module

我有一个模块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)

python import module file

2
推荐指数
1
解决办法
62
查看次数

标签 统计

file ×1

import ×1

module ×1

python ×1