core.py 文件源码

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

项目:start 作者: argeweb 项目源码 文件源码
def escape_html(s, quote=True):
    """
    Replace special characters "&", "<" and ">" to HTML-safe sequences.

    If the optional flag quote is true (the default), the quotation mark
    characters, both double quote (") and single quote (') characters are also
    translated.

    If a `HTMLString` is provied, it's assumed that whatever you give to
    escape_html is a string with any unsafe values already escaped.
    """
    if hasattr(s, '__html__'):
        s = s.__html__()
    else:
        s = escape(text_type(s), quote=quote)
    return s
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号