def safe_quotes ( text , escape_single_quotes = False ) : if isinstance ( text , str ) : safe_text = text . replace ( '"' , "&quot;" ) if escape_single_quotes : safe_text = safe_text . replace ( "'" , "&#92;'" ) return safe_text . replace ( 'True' , 'true' ) return text
flask python replacing quotes in html
htmlify string
def safe_quotes(text, escape_single_quotes=False):
    """htmlify string"""
    if isinstance(text, str):
        safe_text = text.replace('"', "&quot;")
        if escape_single_quotes:
            safe_text = safe_text.replace("'", "&#92;'")
        return safe_text.replace('True', 'true')
    return text