On Wed, 2011-10-26 at 12:48 -0700, Ross Boylan wrote:
> I want to replace every \ and " (the two characters for backslash and
> double quotes) with a \ and the same character, i.e.,
> \ -> \\
> " -> \"
I'd like to thank Ian, Dave, MRAB, and John for their helpful responses.
I hadn't realized the in
On Oct 26, 2:47 pm, Dave Angel wrote:
> On 10/26/2011 03:48 PM, Ross Boylan wrote:
>
>
>
>
>
>
>
> > I want to replace every \ and " (the two characters for backslash and
> > double quotes) with a \ and the same character, i.e.,
> > \ -> \\
> > " -> \"
>
> > I have not been able to figure out ho
On 26/10/2011 20:48, Ross Boylan wrote:
I want to replace every \ and " (the two characters for backslash and
double quotes) with a \ and the same character, i.e.,
\ -> \\
" -> \"
I have not been able to figure out how to do that. The documentation
for re.sub says "repl can be a string or a f
On 10/26/2011 03:48 PM, Ross Boylan wrote:
I want to replace every \ and " (the two characters for backslash and
double quotes) with a \ and the same character, i.e.,
\ -> \\
" -> \"
I have not been able to figure out how to do that. The documentation
for re.sub says "repl can be a string or
On Wed, Oct 26, 2011 at 1:48 PM, Ross Boylan wrote:
> Or perhaps I'm confused about what the displayed results mean. If a
> string has a literal \, does it get shown as \\?
In the repr, yes. If you try printing the string, you'll see that it
only contains one \.
By the way, regular expressions