About 137,000 results
Open links in new tab
  1. Escape special characters in a Python string - Stack Overflow

    Nov 17, 2010 · re.escape(string) Return string with all non-alphanumerics backslashed; this is useful if you want to match an arbitrary literal string that may have regular expression …

  2. How can I selectively escape percent (%) in Python strings?

    May 21, 2012 · You can't selectively escape %, as % always has a special meaning depending on the following character. In the documentation of Python, at the bottem of the second table in …

  3. python - How to escape special characters of a string with single ...

    Doing fr'{my_string}' will not change the string contents.It is equivalent to f'{my_string}' (because the r only applies at the time the string literal is interpreted, and none of {, m, y, _, s, t, r, i, n, g, …

  4. python - How do I escape curly-brace ({}) characters characters in a ...

    @wjandrea your link really doesn't pertain to the OPs question. The OP wants to keep curly-braces while you are removing them in your linked answer via .format() and your dictionary …

  5. regex - How to escape “\” characters in python - Stack Overflow

    Apr 27, 2012 · Regular string literals observe backslash escaping, so to actually put a backslash in the string, you need to escape it too. Raw string literals treat backslashes like any other …

  6. How to write string literals in Python without having to escape …

    If you use a raw string then you still have to work around a terminal "\" and with any string solution you'll have to worry about the closing ", ', ''' or """ if it is included in your data. That is, there's …

  7. path - Python escape character - Stack Overflow

    That string literal has a tab, a bell, and a newline in it. If you want their to be slashes in the string, you must escape them '\\' or use a raw string r'f:\tab ...'. But I suspect that isn't the problem …

  8. Process escape sequences in a string in Python - Stack Overflow

    Oct 26, 2010 · This doesn't work as written (the forward slashes make the replace do nothing), uses wildly outdated APIs (the string module functions of this sort are deprecated as of Python …

  9. python - Escaping regex string - Stack Overflow

    You can't just drop the string straight into your regex, because it might contain special characters. For instance, if the input string is "foo.bar", the regex will respond that "foozbar" is a match, …

  10. How to accept strings containing escape characters python

    Mar 19, 2013 · Don't use input(); use raw_input() instead when accepting string input. input() (on Python 2) tries to interpret the input string as Python, raw_input() does not try to interpret the …

Refresh