utils.py 文件源码

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

项目:swjtu-pyscraper 作者: Desgard 项目源码 文件源码
def is_undefined(obj):
    """Check if the object passed is undefined.  This does nothing more than
    performing an instance check against :class:`Undefined` but looks nicer.
    This can be used for custom filters or tests that want to react to
    undefined variables.  For example a custom default filter can look like
    this::

        def default(var, default=''):
            if is_undefined(var):
                return default
            return var
    """
    from jinja2.runtime import Undefined
    return isinstance(obj, Undefined)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号