`

代码笔记

 
阅读更多
def _resolve(name):
    """将字符串转为对象"""
    """Resolve a dotted name to a global object."""
    name = name.split('.')
    used = name.pop(0)
    found = __import__(used)
    for n in name:
        used = used + '.' + n
        try:
            found = getattr(found, n)
        except AttributeError:
            __import__(used)
            found = getattr(found, n)
    return found



def _strip_spaces(alist):
    """去除列表里的字符串的空格"""
    return map(lambda x: x.strip(), alist)
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics