python中获取Python模块文件的路径【面试题详解】

今天爱分享给大家带来python中获取Python模块文件的路径【面试题详解】,希望能够帮助到大家。
如何才能获取一个模块其所在的路径


import a_module
print a_module.__file__

获取其所在目录,可以


import os
path = os.path.dirname(amodule.__file__)

原文链接:https://blog.itblood.com/4485.html,转载请注明出处。
0
耳语松林的启示录Ch2赞助 AI版[PC+安卓/4.63G/更新]RevelationsofWhisperingPines [Ch2 Full] [欧美SLG/汉化/动态]
耳语松林的启示录Ch2赞助 AI版[PC+安卓/4.63G/更新]RevelationsofWhisperingPines [Ch2 Full] [欧美SLG/汉化/动态]
10分钟前 有人购买 去瞅瞅看

站点公告

显示验证码
没有账号?注册  忘记密码?