(text)
return text[:start] + 'x' * (end - start) + text[end:]
Replace contents with 'xxx' to prevent syntax matching.

    >>> mute_string('"abc"')
    '"xxx"'
    >>> mute_string("'''abc'''")
    "'''xxx'''"
    >>> mute_string("r'abc'")
    "r'xxx'"
Replace contents with 'xxx' to prevent syntax matching.
Replace contents with xxx to prevent syntax matching .
def mute_string(text):
    """Replace contents with 'xxx' to prevent syntax matching.

    >>> mute_string('"abc"')
    '"xxx"'
    >>> mute_string("'''abc'''")
    "'''xxx'''"
    >>> mute_string("r'abc'")
    "r'xxx'"
    """
    # String modifiers (e.g. u or r)
    start = text.index(text[-1]) + 1
    end = len(text) - 1
    # Triple quotes
    if text[-3:] in ('"""', "'''"):
        start += 2
        end -= 2
    return text[:start] + 'x' * (end - start) + text[end:]
def mute_string ( text ) : # String modifiers (e.g. u or r) start = text . index ( text [ - 1 ] ) + 1 end = len ( text ) - 1 # Triple quotes if text [ - 3 : ] in ( '"""' , "'''" ) : start += 2 end -= 2 return text [ : start ] + 'x' * ( end - start ) + text [ end : ]