At 2008-06-24T20:27:33Z, regex_jedi <[EMAIL PROTECTED]> writes:
> Notice that the 4th value has a single quote in it. Well, I need to
> make sure that the single quote is escaped before handing it off for
> further processing to a class I later call for some other processing.
Out of curiosity, wh
Le Tuesday 24 June 2008 22:27:33 regex_jedi, vous avez écrit :
> ok, I have looked a lot of places, and can't seem to get a clear
> answer...
>
> I have a string called
>each_theme
>
> Some values of the string may contain a single quote as in -
>Happy
>Sad
>Nice
>Frank's Laundr
Dan Bishop a écrit :
On Jun 24, 4:04 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
Are you trying to escape for a regular expression?
Just do re.escape().
print re.escape('Happy')
Happy
print re.escape("Frank's Diner")
Frank\'s\ Diner
If you're escaping for URLs, there's urllib2.quot
On Jun 24, 4:04 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Are you trying to escape for a regular expression?
>
> Just do re.escape().
>
> >>> print re.escape('Happy')
> Happy
> >>> print re.escape("Frank's Diner")
>
> Frank\'s\ Diner
>
> If you're escaping for URLs, there's urllib2.quote
Are you trying to escape for a regular expression?
Just do re.escape().
>>> print re.escape('Happy')
Happy
>>> print re.escape("Frank's Diner")
Frank\'s\ Diner
If you're escaping for URLs, there's urllib2.quote(), for a command
line, use subprocess.list2cmdline.
Generally, the module that consu
ok, I have looked a lot of places, and can't seem to get a clear
answer...
I have a string called
each_theme
Some values of the string may contain a single quote as in -
Happy
Sad
Nice
Frank's Laundry
Explosion
Notice that the 4th value has a single quote in it. Well, I need to