util.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:zing 作者: evernote 项目源码 文件源码
def import_func(path):
    i = path.rfind('.')
    module, attr = path[:i], path[i+1:]
    try:
        mod = import_module(module)
    except ImportError, e:
        raise ImproperlyConfigured('Error importing module %s: "%s"'
                                   % (module, e))
    try:
        func = getattr(mod, attr)
    except AttributeError:
        raise ImproperlyConfigured(
            'Module "%s" does not define a "%s" callable function'
            % (module, attr))

    return func
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号