Re: Problems replacing \ with \\

2008-05-03 Thread [EMAIL PROTECTED]
Sorry for the late response. I've been travelling internationally and am just getting back to work. So--thank you to everyone who responded! To answer everyone's question I am dumping all of the data from a mysql database, then creating a postgresql database, then inserting the data into the

Re: Problems replacing \ with \\

2008-04-21 Thread Gabriel Genellina
(top posting corrected) En Mon, 21 Apr 2008 21:12:44 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribió: > def escape(string): > """ > Escape both single quotes and blackslashes > >>> x = r"fun\fun" > >>> escape(x) > 'funfun' > """ > string = string.replace

Re: Problems replacing \ with \\

2008-04-21 Thread Michael Torrie
[EMAIL PROTECTED] wrote: > Hi... > > Here's a weird problem...I'm trying to escape a bunch of data to put > into a database. Is it possible to use the database API and prepared statements to avoid having to go through this exercise? Also, most database APIs work natively in unicode, so creating

Re: Problems replacing \ with \\

2008-04-21 Thread [EMAIL PROTECTED]
HTH -- Thank you for the response. I'm not sure I understand the last sentence, although I think I get the idea. How do I create a proper doctest? Thanks On Apr 21, 9:08 pm, MRAB <[EMAIL PROTECTED]> wrote: > On Apr 21, 11:48 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > > > Hi...

Re: Problems replacing \ with \\

2008-04-21 Thread MRAB
On Apr 21, 11:48 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi... > > Here's a weird problem...I'm trying to escape a bunch of data to put > into a database. > > Here's what I have: > > def escape(string): > """ > Escape both single quotes and blackslashes > >>> x = r"fun\fun"

Problems replacing \ with \\

2008-04-21 Thread [EMAIL PROTECTED]
Hi... Here's a weird problem...I'm trying to escape a bunch of data to put into a database. Here's what I have: def escape(string): """ Escape both single quotes and blackslashes >>> x = r"fun\fun" >>> escape(x) 'funfun' """ string = string.replace('\\', '')