def get_config(data, expr, default=None):
    """
    使用a.[b].c表达式从对象中获取值
    :param data:     对象,支持getattr的任意对象
    :type data:      any
    :param expr:     路径表达式，eg. log.path
    :type expr:      str
    :param default:  如果表达式的值不存在，则返回默认值
    :type default:   any
    """
    names = expr.split('.')
    result = data
    for name in names:
        try:
            result = getattr(result, name)
        except AttributeError:
            result = default
            break
    return result
