代码笔记

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)

你可能感兴趣的:(代码)