# coding:utf-8
import os
import inspect
import sys
def GetPath(module=None):
"""获取当前模块所在路径"""
if not module:
module = GetPath
print module
cur_module = inspect.getmodule(module)
print cur_module
path = os.path.dirname(cur_module.__file__)
return path
print GetPath()
print "========================"
print GetPath(sys.modules['os'])
import os
import inspect
import sys
def GetPath(module=None):
"""获取当前模块所在路径"""
if not module:
module = GetPath
print module
cur_module = inspect.getmodule(module)
print cur_module
path = os.path.dirname(cur_module.__file__)
return path
print GetPath()
print "========================"
print GetPath(sys.modules['os'])