Re: re.sub and re.MULTILINE

2007-01-09 Thread nyenyec
Paddy wrote: > Check the arguments to re.sub. > > >>> re.sub('(?m)^foo', 'bar', '\nfoo', count=0) > '\nbar' > > - Paddy. Duh! :) I appreciate it, thanks. -- nyenyec -- http://mail.python.org/mailman/listinfo/python-list

re.sub and re.MULTILINE

2007-01-08 Thread nyenyec
I feel like a complete idiot but I can't figure out why re.sub won't match multiline strings: This works: >>> re.search("^foo", "\nfoo", re.MULTILINE) <_sre.SRE_Match object at 0x6c448> This doesn't. No replacement: >>> re.sub("^fo

re.sub and re.MULTILINE

2007-01-08 Thread nyenyec
I feel like a complete idiot but I can't figure out why re.sub won't match multiline strings: This works: >>> re.search("^foo", "\nfoo", re.MULTILINE) <_sre.SRE_Match object at 0x6c448> This doesn't. No replacement: >>> re.sub("^fo

Re: urlib.quote gives KeyError in Python 2.4.4 but workin 2.3.5

2007-01-07 Thread nyenyec
encode seems to solve my problem: >>> urllib.quote(u'\xe9'.encode('utf-8')) '%C3%A9' Cheers, nyenyec nyenyec wrote: > urllib.quote chokes on unicode in 2.4.4. > > >>> print sys.version > 2.4.4 (#1, Oct 18 2006, 10:34:39) > [GCC 4.0

urlib.quote gives KeyError in Python 2.4.4 but workin 2.3.5

2007-01-07 Thread nyenyec
help", "copyright", "credits" or "license" for more information. >>> import sys, urllib >>> print sys.version 2.3.5 (#1, Aug 19 2006, 21:31:42) [GCC 4.0.1 (Apple Computer, Inc. build 5363)] >>> urllib.quote(u'\xe9') '%E9' Is this a known bug? What's the workaround? Thanks, nyenyec -- http://mail.python.org/mailman/listinfo/python-list